Deploy NX Angular Monorepo App: Failed to compute cache key, no such file or directory


I’m currently trying to deploy an NX Angular Monorepo App but am getting an error

Please note that I’ve replaced the actual app name with [app] so that it is clear. Also because this is a monorepo, when we run the build command, we then try to reference a directory /dist/apps/[app]. Serve small with and GoStatic · Fly has been reference.

 => CACHED [stage-1 2/3] RUN npx nx build geoaudit --prod                                                                                                                                                         0.0s
 => ERROR [stage-1 3/3] COPY ./dist/apps/geoaudit/ /srv/http/                                                                                                                                                     0.0s
 > [stage-1 3/3] COPY ./dist/apps/[app]/ /srv/http/:
Error failed to fetch an image or build from source: error building: failed to compute cache key: failed to walk /data/docker/tmp/buildkit-mount186432374/dist/apps: lstat /data/docker/tmp/buildkit-mount186432374/dist/apps: no such file or directory


# Dockerfile

FROM node:14.20

# Installing libvips-dev for sharp Compatability
RUN apt-get update && apt-get install libvips-dev -y

# Copy the configuration files
COPY ./package.json ./package-lock.json ./
ENV PATH /opt/node_modules/.bin:$PATH

# Install dependencies
RUN npm install

# Copy the application files
WORKDIR /opt/app
COPY ./ .

# Build the Angular application
RUN npx nx build [app] --prod

FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html" ]
COPY ./dist/apps/[app]/ /srv/http/