Skip to content

Instantly share code, notes, and snippets.

@adrianhorning08
Created May 1, 2025 18:19
Show Gist options
  • Save adrianhorning08/83e0953fe7ac9d6f136fc59d4d60dc03 to your computer and use it in GitHub Desktop.
Save adrianhorning08/83e0953fe7ac9d6f136fc59d4d60dc03 to your computer and use it in GitHub Desktop.
Docker for puppeteer real browser
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