Created
May 1, 2025 18:19
-
-
Save adrianhorning08/83e0953fe7ac9d6f136fc59d4d60dc03 to your computer and use it in GitHub Desktop.
Docker for puppeteer real browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:20-bullseye | |
# Install Chrome and xvfb | |
RUN apt-get update && apt-get install -y \ | |
chromium \ | |
xvfb \ | |
&& rm -rf /var/lib/apt/lists/* | |
WORKDIR /usr/src/app | |
# Copy package files and install dependencies | |
COPY package*.json ./ | |
RUN npm install | |
# Copy source code | |
COPY . . | |
# Set up the entrypoint script | |
RUN echo '#!/bin/bash\nxvfb-run --server-args="-screen 0 1920x1080x24" node index.js "$@"' > entrypoint.sh | |
RUN chmod +x entrypoint.sh | |
ENTRYPOINT ["./entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment