Hi,
my task is to build the Single-Page-Application (Stage 1) and then serve it with NGNIX (Stage 2)
FROM node:8.11.4-alpine AS build
WORKDIR /usr/local/app
COPY . .
RUN npm install
RUN npm run buildFROM nginx:1.15.2-alpine
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/conf.d/default.conf /etc/nginx/conf.d/
COPY --from=build /usr/local/app/dist/MY-APP /usr/share/nginx/html
In Stage 1 I copy all the src files into the build container. To improve this process I created a .dockerignore (as it is suggested in the docs). For the build I obviously do not need the nginx files. Therefore they are part of the .dockerignore.
dist
e2e
nginx
node_modules
.editorconfig
.gitignore
npm-debug.log
README.md
tslint.json
The problem - as soon as the Stage 2 begins, the ngnix entry in the .dockerignore file prevents that the ngnix files can be copied! So the only working solution so far is to remove ngnix from the .dockerignore and therefore copy it into without any need the build container (Stage 1). This is not how it should be!
Feature request - provide a better multi-stage .dockerignore support.
There are probably several solution designs possible.
My personal solution idea would be a āblock definitionā in .dockerignore similar to the one used in the Dockerfile (here it is separated by the āFROMā keyword)
So, what is your opinion to this guys?
Any other solutions or thoughts?