Im currently doing some cleanup and refactoring of an open source project’s ci system (this one). Our setup is likely quite a common one; we have Dockerfiles which create an image that contains our build environment, then we run a container from this image, map in our source directory as a volume, and run our build commands.
This generally works well, but it means if you have a set of complicated build commands you’ll need a script to actually perform the build within the container. You’ll also likely need a script to build the image and run the container. This is fine for CI, but if a user then wants to easily reproduce the results locally they’ll have to understand how these scripts work instead of for example just building an image.
I was wondering if it’s a common practice to do the entire build at the image construction step, without even running a container. Instead of mapping in a volume with the source you could do an ‘ADD’ from the image. You’d have to start a container in the end to copy artifacts out, but the advantage is the only thing a user would have to do to reproduce CI results would be to run a ‘docker build -f’.
One concern I’d have with this approach is that continually building images on the CI server would eventually fill the disk space, or use all the inodes, etc. (possibly even when running periodic image/container cleans). Is this a valid concern with modern docker, or does it cleanup well after itself with most storage drivers today.