Skip to content

Instantly share code, notes, and snippets.

@ziazon
Created January 28, 2020 01:49
Show Gist options
  • Save ziazon/06925d91d7bff3e9960a5eb0cb322ccb to your computer and use it in GitHub Desktop.
Save ziazon/06925d91d7bff3e9960a5eb0cb322ccb to your computer and use it in GitHub Desktop.
my node.js Dockerfile
FROM node:lts-alpine as build
WORKDIR /app
COPY ./package-lock.json ./package.json ./
RUN npm ci
COPY . .
ENV NODE_ENV=production
RUN npm run build
FROM node:lts-alpine as serve
WORKDIR /app
COPY --from=build /app/dist /app/dist
COPY ./package-lock.json ./package.json ./
ENV NODE_ENV=production
RUN npm install --only=prod
EXPOSE 8080
CMD ["node", "dist/server.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment