Created
May 19, 2020 18:37
-
-
Save wesleyegberto/a0dc1da88168acf8e75f1abcb8e41c55 to your computer and use it in GitHub Desktop.
Example of Dockerfile to build Node app using multistage to lower its image size (without the large node_node modules).
This file contains 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
# Stage 1 - the build process | |
FROM node:10-alpine as build-deps | |
WORKDIR /src | |
COPY package.json package-lock.json ./ | |
RUN npm i --silent | |
COPY . ./ | |
RUN npm run build | |
# Stage 2 - the production environment | |
FROM nginx:1.12-alpine | |
COPY --from=build-deps /src/build /usr/share/nginx/html | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment