Last active
April 19, 2020 16:39
-
-
Save itsmunim/6a9a289ced9fc85bfb4729e13c86136e to your computer and use it in GitHub Desktop.
Multi stage docker build for NodeJS Service
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
# installation step # | |
FROM node:lts-alpine3.9 AS builder | |
ENV BUILD_DIR /build | |
RUN mkdir -p $BUILD_DIR | |
WORKDIR $BUILD_DIR | |
COPY . $BUILD_DIR/ | |
RUN npm install --no-audit | |
# if you have any build step, you should include that | |
# in this stage as well. e.g. npm run build | |
# package image step | |
FROM node:lts-alpine3.9 AS runtime | |
EXPOSE 8080 | |
# -- # | |
ENV APP_HOME /app | |
RUN mkdir -p $APP_HOME | |
WORKDIR $APP_HOME | |
COPY --from=builder /build ./ | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment