Skip to content

Instantly share code, notes, and snippets.

@pjlamb12
Created December 6, 2022 15:29
Show Gist options
  • Save pjlamb12/8b2e7d09a49fcfa61e3b5756658ac441 to your computer and use it in GitHub Desktop.
Save pjlamb12/8b2e7d09a49fcfa61e3b5756658ac441 to your computer and use it in GitHub Desktop.
Dockerfile for running the Node app with puppeteer
FROM node:18 as node-build
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build:dynamic-pdf-generator
RUN npm install dd-trace --save
ENV EXECUTABLE_PATH=/usr/bin/google-chrome
ENTRYPOINT [ "node", "--require", "dd-trace/init", "./dist/apps/dynamic-pdf-generator/main.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment