Skip to content

Instantly share code, notes, and snippets.

@bbrewer97202
Last active April 9, 2024 22:34
Show Gist options
  • Save bbrewer97202/47884bcb77f9dae48ad243f2d01c0c05 to your computer and use it in GitHub Desktop.
Save bbrewer97202/47884bcb77f9dae48ad243f2d01c0c05 to your computer and use it in GitHub Desktop.
Boilerplate for node app Dockerfile
# create .dockerignore with node_modules, dist, etc
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json /app
RUN npm install
COPY . /app
RUN npm run build
FROM node:18.20.1-bullseye-slim AS production
ENV NODE_ENV=production
WORKDIR /app
EXPOSE 8000
COPY package*.json /app
RUN npm ci --only=production
COPY --chown=node:node --from=build /app/dist /app
USER node
CMD ["node", "index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment