Architectural Patterns
by Anupama Murali, Pethuru Raj, Harihara Subramanian J, Pethuru Raj Chelliah
Using bind-mount volumes
It is not good to have the compilation step as a part of the build process of the container. The overwhelming expectation is that Docker images need to be highly reusable. If the source code is modified, then it is necessary to rebuild the build image, but it is desired to run the same build image again.
Therefore, the compilation step has to be moved to the ENTRYPOINT (https://docs.docker.com/engine/reference/builder/#entrypoint) or CMD instruction. The source/files shouldn't be part of the build context and instead, mounted as a bind-mount volume inside the running build container.
The advantages are many here. Every time one runs the build container, it will compile the files in the /project/source/ and produce ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access