Created
May 16, 2021 21:39
-
-
Save faforty/465aa6d36486bb3472b5f10f1c2d07a7 to your computer and use it in GitHub Desktop.
dockerfile-nestjs
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
# этап сборки (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