0

NGINX keeps failing with

--from=stage-1 /usr/src/dist/apps/admin-panel /usr/share/nginx/html
no such file or directory

FROM node:18.10-alpine as stage-1

WORKDIR /usr/src/app

RUN npm install -g @angular/cli
RUN npm install -g @nrwl/cli

COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build:admin

FROM nginx:alpine as stage-2
COPY --from=stage-1 /usr/src/dist/apps/admin-panel /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf

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

we built an angular frontend (singlepageapp) and my part is to deploy. ive never done this before and i put in a lot of hours to get to this part. so close but i guess far from finish. We built it with Nx. my dist folder is in my main directory as you can see above. but it keeps failing.

i also tried app/dist/..., apps/dist/..., the other way round. when i build it localy the dist folder apears, build is successful, even in the dockerbuild the build is successful.

thats the cmd line output:

=> ERROR [stage-2 2/3] COPY --from=stage-1 /usr/src/dist/apps/admin-panel /usr/share/nginx/html                   0.0s
------
 > [stage-2 2/3] COPY --from=stage-1 /usr/src/dist/apps/admin-panel /usr/share/nginx/html:
------
failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount1569387116/usr/src/dist/apps: lstat /var/lib/docker/tmp/buildkit-mount1569387116/usr/src/dist/apps: no such file or directory

any idea how to get this right? never thought its hard to struggle with a simple path.

  • If you build outside the container, do you end up with a directory named admin-panel at the root of your app? What does your directory structure look like? – J. Titus Jun 04 '23 at 20:25

0 Answers0