Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@faforty
Created May 16, 2021 21:39
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 faforty/465aa6d36486bb3472b5f10f1c2d07a7 to your computer and use it in GitHub Desktop.
Save faforty/465aa6d36486bb3472b5f10f1c2d07a7 to your computer and use it in GitHub Desktop.
dockerfile-nestjs
# этап сборки (build stage)
FROM node:lts-alpine as build-stage
RUN echo http://mirror.yandex.ru/mirrors/alpine/v3.5/main > /etc/apk/repositories; \
echo http://mirror.yandex.ru/mirrors/alpine/v3.5/community >> /etc/apk/repositories
WORKDIR /app
COPY package*.json ./
# COPY .npmrc ./
RUN yarn install --frozen-lockfile
COPY . .
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
RUN yarn build
# этап production (production-stage)
FROM node:lts-alpine as production-stage
WORKDIR /home/node
COPY --from=build-stage /app/package*.json /home/node/
COPY --from=build-stage /app/dist /home/node/dist/
RUN yarn install --frozen-lockfile --production
EXPOSE 3000
CMD ["yarn", "start:prod"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment