# common base image for development and
FROM node:10.15.3 AS
WORKDIR /app
ARG SC_NPM_TOKEN
ENV SC_NPM_TOKEN="${SC_NPM_TOKEN}"
# dev image contains everything needed for testing, development and building
FROM base AS development
COPY . /app
# install all dependencies and add source code
RUN npm install
RUN npm install -g @angular/cli@7.3.9
# builder runs unit tests and linter, then builds production code
FROM development as builder
RUN npm run build:ssr --prod --output-path=dist
# RUN ls -ls ../
# RUN ls -ls .
# RUN pwd
# release includes bare minimum required to run the app, copied from builder
FROM base AS release
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/
ENV NODE_ENV "production"
ENV PORT 3000
EXPOSE 3000
CMD ["npm", "run ", "serve:ssr"]
When I use this Dockerfile, the container can be build and the nodejs application is started as well. If I try to access the / route, the following error is thrown: Failed to lookup view "index" in views directory "/app/dist/browser".
I took a look inside of the container and saw that the files are stored in /app/app/. How can there be a second app directory? If I move the files into the /app directory, everything works fine. As I don't understand how the second app directory is created, I can't seem to fix the Dockerfile. I added a couple of debug commands, but I can't see the second app directory when the container is build.