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.
-
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
Dockerfile
into a newDockerfile
that started withFROM tomcat
, but then I'd need to copy all the scripts the micromambaDockerfile
calls into my new repo as well. If any of those scripts were later modified within themamba-org/micromamba-docker
repo, 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/micromamba
image. Now if an updated version ofmambaorg/micromamba
is released, I only need to update themambaorg/micromamba
tag within my downstreamDockerfile
and it will pickup the newermicromamba
binary along with any changes to the included scripts.The exercise has me debating with myself if the following code from the micromamba
Dockerfile
should 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/micromamba
tag 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 theDockerfile
and understand exactly what is being done.The functionality in the above code block can be broken into 2 topics:
$MAMBA_ROOT_PREFIX
Perhaps it makes sense to create a script for each of these two activities. This should give a reader of the
mamba-org/micromamba-docker
Dockerfile
a 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