I created two apps with NX. An admin frontend as well as a website. Both of these apps have a separate Dockerfile and nginx-default.conf which looks kind of like this:
# Build the whole nx workspace
FROM node:lts-alpine AS builder
WORKDIR /app
COPY ../.. ./
RUN npm i && npm run prodbuild
# Setup nginx to serve the {app}
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
ADD nginx-default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist/apps/{app}.
EXPOSE 80
Basically I am building and copying my entire nx workspace everytime just to create the nginx image with the built files. My computer sense is tingling to somehow improve this but I have not yet found any nx information on how to build single apps. Maybe this problem does not have to do with nx but rather Docker? Does someone know how to handle such a situation?