Last active
April 9, 2024 22:34
-
-
Save bbrewer97202/47884bcb77f9dae48ad243f2d01c0c05 to your computer and use it in GitHub Desktop.
Boilerplate for node 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
# 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