Last active
March 24, 2023 03:30
-
-
Save evzpav/14598d3eb93e5c77c6875860d14a0267 to your computer and use it in GitHub Desktop.
Dockerfile Nest project
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
# ---- Base Node ---- | |
FROM node:19-alpine3.16 AS base | |
ENV NODE_ENV=development | |
RUN mkdir /app && chown -R node:node /app | |
WORKDIR /app | |
USER node | |
RUN npm set progress=false && npm config set depth 0 | |
# ---- Dependencies ---- | |
FROM base AS dependencies | |
WORKDIR /app | |
COPY --chown=node:node package*.json ./ | |
RUN npm ci && npm cache clean --force | |
# ---- Build ---- | |
FROM dependencies AS build | |
WORKDIR /app | |
COPY --chown=node:node . /app/ | |
RUN npm run build | |
# ---- Release ---- | |
FROM build AS image | |
WORKDIR /app | |
COPY --chown=node:node ./dist ./dist | |
ENV NODE_ENV=production | |
CMD node dist/src/main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment