Using a multi-stage build to add micromamba functionality to an existing image #175
Replies: 1 comment 4 replies
-
I'm all in favor of multiple small scripts with long descriptive filenames, e.g. along the lines of (In general I find the problem of "merging" Dockerfiles intriguing. It seems to be a common problem with no good solution. I would have suggested modifying tomcat to use micromamba as the base, until I noticed that tomcat uses eclipse as a base image, which is an annoying complication.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dockerfile for tomcat with micromamba
I needed to use a tomcat image but wanted to have multiple R/Python (conda) environments within the final image. I could have copied and pasted the contents of the micromamba
Dockerfileinto a newDockerfilethat started withFROM tomcat, but then I'd need to copy all the scripts the micromambaDockerfilecalls into my new repo as well. If any of those scripts were later modified within themamba-org/micromamba-dockerrepo, I would then have to manually update my downstream repo to keep up to date with the changes. By using a multi-stage build, I am able to copy the scripts directly from themambaorg/micromambaimage. Now if an updated version ofmambaorg/micromambais released, I only need to update themambaorg/micromambatag within my downstreamDockerfileand it will pickup the newermicromambabinary along with any changes to the included scripts.The exercise has me debating with myself if the following code from the micromamba
Dockerfileshould be moved into a separate script file:micromamba-docker/Dockerfile
Lines 34 to 41 in 41d5bd8
The argument for such a change, is that my above use case would then automatically track changes to this code block when I update the
mambaorg/micromambatag within my downstreamDockerfile. A reason for not making this change is that it hides details in other files which makes it hard for someone to glance at theDockerfileand understand exactly what is being done.The functionality in the above code block can be broken into 2 topics:
$MAMBA_ROOT_PREFIXPerhaps it makes sense to create a script for each of these two activities. This should give a reader of the
mamba-org/micromamba-dockerDockerfilea better conceptual understanding of what is being done, even if the details require going into other files.@maresb - care to offer an opinion on this possible change?
Beta Was this translation helpful? Give feedback.
All reactions