Skip to content

Instantly share code, notes, and snippets.

@fuglu
Created December 6, 2019 11:50
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 fuglu/0dbfca1e0b827ba8470fb4ba26ac5d75 to your computer and use it in GitHub Desktop.
Save fuglu/0dbfca1e0b827ba8470fb4ba26ac5d75 to your computer and use it in GitHub Desktop.
Basic Node.js Dockerfile
FROM node:lts-alpine AS builder
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run test
RUN npm run build
FROM node:lts-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --production
COPY --from=builder /usr/src/app/dist/ dist/
USER node
EXPOSE 3000
ENTRYPOINT ["node", "dist/index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment