Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foufrix/06925cc627cb01ded2d40ff70c79f6fb to your computer and use it in GitHub Desktop.
Save foufrix/06925cc627cb01ded2d40ff70c79f6fb to your computer and use it in GitHub Desktop.
# Set the base image to Node 18
FROM node:18
# File Author / Maintainer
LABEL maintainer=your_email@gmail.com"
# Update the repository sources list
RUN apt-get update && apt-get upgrade -y
# Install Chromium
RUN apt-get install -y chromium
# Set the working directory to /app
WORKDIR /app
# Bundle your app source inside the docker image
COPY . .
# Install all the dependencies
RUN npm ci
# Build the API
RUN npm run build <your-app-name> # command to build an app in an NX monorepo; replace with your app build command
# Your app binds to port 8080 so you'll use the EXPOSE instruction to have it mapped by the docker daemon
EXPOSE 8080
# Set environment variable to disable Chromium's sandbox (this is required if you are running as root)
ENV CHROME_BIN=/usr/bin/chromium-browser
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_ARGS='--no-sandbox'
# Start command
CMD [ "node", "dist/apps<your-app-name>/main.js" ] # again replace this with your specific node command to start your app/service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment