Skip to content

Instantly share code, notes, and snippets.

@gm50x
Created November 11, 2020 23:15
Show Gist options
  • Save gm50x/18a8103a86258e72736f781f4a9ab875 to your computer and use it in GitHub Desktop.
Save gm50x/18a8103a86258e72736f781f4a9ab875 to your computer and use it in GitHub Desktop.
Node-Nestjs multiphased dockerfile
FROM node:lts-alpine3.12 AS build
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:lts-alpine3.12 AS runtime
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY --from=build /usr/src/app/dist/* ./
CMD [ "node", "main" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment