11# This Dockerfile can be used for docker-based deployments to platforms
22# like Now or Moda, but it is currently _not_ used by our Heroku deployments
3- # It uses three multi-stage builds: `installation`, `bundles`, and the main build.
3+ # It uses two multi-stage builds: `install` and the main build to keep the image size down .
44
55# --------------------------------------------------------------------------------
6- # INSTALLATION IMAGE
7- # A temporary image that installs production-only dependencies
6+ # INSTALL IMAGE
7+ # A temporary image that installs production-only dependencies and builds the production-ready front-end bundles.
88
9- FROM node:14-alpine as installation
9+ FROM node:14-alpine as install
1010RUN apk add --no-cache python make g++
1111ENV NODE_ENV production
1212WORKDIR /usr/src/docs
1313COPY package*.json ./
14-
15- # Install the project's dependencies
16- RUN npm ci --production
17-
18- # --------------------------------------------------------------------------------
19- # BUNDLE IMAGE
20- # A temporary image that installs dependencies and builds the production-ready front-end bundles.
21-
22- FROM node:14-alpine as bundles
23- RUN apk add --no-cache python make g++
24- ENV NODE_ENV production
25- WORKDIR /usr/src/docs
26- # Install the files used to create the bundles
27- COPY package*.json ./
2814COPY javascripts ./javascripts
2915COPY stylesheets ./stylesheets
3016COPY lib ./lib
3117COPY webpack.config.js ./webpack.config.js
32- # Install the project's dependencies and build the bundles
3318RUN npm ci --production
3419RUN npm run build
3520
@@ -48,10 +33,10 @@ RUN chown node:node /usr/src/docs -R
4833USER node
4934
5035# Copy our dependencies
51- COPY --chown=node:node --from=installation /usr/src/docs/node_modules /usr/src/docs/node_modules
36+ COPY --chown=node:node --from=install /usr/src/docs/node_modules /usr/src/docs/node_modules
5237
5338# Copy our front-end code
54- COPY --chown=node:node --from=bundles /usr/src/docs/dist /usr/src/docs/dist
39+ COPY --chown=node:node --from=install /usr/src/docs/dist /usr/src/docs/dist
5540
5641# We should always be running in production mode
5742ENV NODE_ENV production
0 commit comments