From 8cf4c5279ff5de414b1f51f07606a914fecf1220 Mon Sep 17 00:00:00 2001 From: Malik Bougacha Date: Wed, 2 Sep 2020 13:31:03 +0200 Subject: [PATCH 1/2] add completed dockerfile to build the whole angular app --- Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 085010a0..5ff34e4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,19 @@ +FROM node:10 AS builder +COPY package.json package-lock.json ./ +RUN npm install +## Storing node modules on a separate layer will prevent unnecessary npm installs at each build +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true +RUN npm i && mkdir /ng-app && mv ./node_modules ./ng-app +WORKDIR /ng-app +COPY ./ ./ +# building with the --prod flag doesn't produce a binary. +RUN cd src/app && $(npm bin)/ng build --output-path=dist + FROM nginx -COPY dist /usr/share/nginx/html +COPY --from=builder /ng-app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf - - EXPOSE 80 # When the container starts, replace the env.js with values from environment variables From 002d7f11d4605a0740879aeb31369016f5ba3c95 Mon Sep 17 00:00:00 2001 From: Malik Bougacha Date: Thu, 17 Sep 2020 16:22:31 +0200 Subject: [PATCH 2/2] deactivate fetching chromium --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5ff34e4b..01481c5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:10 AS builder COPY package.json package-lock.json ./ RUN npm install ## Storing node modules on a separate layer will prevent unnecessary npm installs at each build -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD false RUN npm i && mkdir /ng-app && mv ./node_modules ./ng-app WORKDIR /ng-app COPY ./ ./