Created
May 16, 2023 21:47
-
-
Save mbleigh/f8e33fe863476f70bfebd6145a0df1c1 to your computer and use it in GitHub Desktop.
Puppeteer Node.js app dockerfile.
This file contains 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:18-slim AS app | |
# We don't need the standalone Chromium | |
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 ./ | |
RUN npm ci --omit=dev | |
COPY . . | |
RUN groupadd -r appuser && useradd -r -g appuser -G audio,video appuser \ | |
&& mkdir -p /home/appuser/Downloads \ | |
&& chown -R appuser:appuser /home/appuser \ | |
&& chown -R appuser:appuser /usr/src/app/node_modules \ | |
&& chown -R appuser:appuser /usr/src/app/package.json \ | |
&& chown -R appuser:appuser /usr/src/app/package-lock.json | |
EXPOSE 8080 | |
USER appuser | |
CMD ["node", "index.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment