Gent
Gent

Reputation: 93

ng build in docker failing after migrating from Angular 7 to 8

We upgraded Angular from 7 to 8.

But while building the docker image this step is failing:

ng "build" "--prod" "--configuration" "development" "--output-path=docs" "--serviceWorker=true" "--verbose" "--progress=true"

Is getting stucked at 11% with this stacktrace:

[webpack.Progress] 11% building 11/12 modules 1 active /app-ui/node_modules/mini-css-extract-plugin/dist/loader.js!/app-ui/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!/app-ui/node_modules/postcss-loader/src/index.js??extracted!/app-ui/node_modules/sass-loader/lib/loader.js??ref--15-3!/app-ui/src/styles.scss
Removing intermediate container e45e8a69a2aa

Then failed to copy a directory in docker:

Step 14/16 : COPY --from=0 /app-ui/docs /usr/share/nginx/html
COPY failed: stat /var/lib/docker/overlay2/***/merged/app-ui/docs: no such file or directory

Here's my Dockerfile:

FROM node:12.10.0-alpine

ENV LC_ALL C

ARG env=production

RUN apk update && apk upgrade && apk add --no-cache make git && rm -rf /var/cache/apk/* /tmp/*

ADD . /app-ui
WORKDIR /app-ui

RUN npm install
RUN npm run ng build -- --prod --configuration $env --output-path=docs --serviceWorker=true --verbose --progress=true

FROM nginx:alpine

RUN apk update && apk upgrade && rm -rf /var/cache/apk/* /tmp/*
RUN rm -rf /usr/share/nginx/html/*
COPY nginx.conf /etc/nginx/nginx.conf

COPY --from=0 /app-ui/docs /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Upvotes: 1

Views: 1276

Answers (0)

Related Questions