OK let’s assume we have a web-app that can be ‘compiled’ such as minifiying css and all that good stuff.
Is the general consensus to:
- Do the build on the developers machine (e.g. npm compile) and then have the Dockerfile copy from the /dist (result of the compile) to the image or…
- Copy the full apps /src to the image and run ‘npm compile’ on the actual image
If I’m thinking of going from github -> running app as quickly as possible (not that this is always the goal) then I want to be able to do git clone xxxx && docker up so that means option 2 I suppose.
I guess what I’m struggling with is does anyone have the notion of a ‘build’ container, like a container whose sole job it is to perform the build of the application and then put the result in a VOLUME for other containers to use? Most of the examples I see revolve around containerizing something that is ready for running rather than dealing with ‘source’.