0

I am trying to deploy angular to openshift, but I am getting issues on docker copy stage

--> 68671715781
[2/2] STEP 5/8: COPY --from=0 /dist/frontend /usr/share/nginx/html
error: build error: error building at STEP "COPY --from=0 /dist/frontend /usr/share/nginx/html": checking on sources under "/var/lib/containers/storage/overlay/e16d5b2c18831dddf755ed3fa87f3bcac4f0720c799764d8dfe4bd5c5a8aa3dc/merged": copier: stat: "/dist/frontend": no such file or directory

I have select Docker file Strategy to deploy on openshift.

enter image description here

DockerFile

FROM node:14.20-alpine

WORKDIR /usr/src/app
COPY package.json package.json
RUN npm install --silent
COPY . .

RUN npm run build --prod --output-path=/dist/frontend

# stage 2
FROM nginx:alpine
WORKDIR /usr/src/app
RUN rm -rf /usr/share/nginx/html/*
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=0 /dist/frontend /usr/share/nginx/html

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

Angular.json output directory set to dist/frontend

enter image description here

Kuldeep
  • 599
  • 11
  • 28
  • Perhaps the unnamed stages are a problem. Better `FROM node:14.20-alpine as builder`. If not, inspect the image of the builder. Are the files under the expected folder? – akop Oct 20 '22 at 09:17
  • @akop adding stage name did not helped – Kuldeep Oct 20 '22 at 09:39
  • Then inspect the outcome of the builder image. The builder-stage producing intermediate images (hashes are shown in STDOUT of `docker build .`) which can start with a bash. Or, place some debug `RUN`-cmds. Like `RUN ls /dist/frontend/`. – akop Oct 20 '22 at 10:55

0 Answers0