Skip to content

Instantly share code, notes, and snippets.

@gavinminami
Created March 26, 2020 22:23
Show Gist options
  • Save gavinminami/41f547e84d70233f14939cea0ca2b9b5 to your computer and use it in GitHub Desktop.
Save gavinminami/41f547e84d70233f14939cea0ca2b9b5 to your computer and use it in GitHub Desktop.
Sample multi-stage Dockerfile
FROM node:13.10.1 as builder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json \
package-lock.json \
tsconfig.json \
/usr/src/app/
COPY src \
/usr/src/app/src
RUN ls -R /usr/src/app
RUN npm install
RUN npm run prepare
RUN ls -R /usr/src/app/lib
FROM node:13.10.1
WORKDIR /usr/src/app
COPY package.json \
package-lock.json \
tsconfig.json \
/usr/src/app/
COPY public \
/usr/src/app/public
COPY --from=builder /usr/src/app/lib \
/usr/src/app/lib
RUN ls /usr/src/app
RUN npm install --production
EXPOSE 3000
CMD [ "npm", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment