Created
June 30, 2025 14:32
-
-
Save jgcmarins/e6909359b84b2623ba7893e9c54dce0c to your computer and use it in GitHub Desktop.
Node.js Dockerfile for perfomance
This file contains hidden or 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:22.16-alpine AS builder | |
WORKDIR /app | |
COPY package.json yarn.lock ./ | |
RUN yarn install --frozen-lockfile | |
COPY . . | |
RUN yarn build | |
RUN rm -rf node_modules && yarn install --production --frozen-lockfile | |
FROM alpine AS runtime | |
WORKDIR /app | |
RUN apk add --no-cache nodejs-lts | |
COPY --from-builder /app/package.json ./ | |
COPY --from-builder /app/node_modules ./node_ modules | |
COPY --from-builder /app/dist ./dist | |
EXPOSE 3000 | |
CMD ["node", "dist/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment