Reputation: 4639
FROM
statement. Let's call this new Dockerfile Dokerfile.development
.Dockerfile.deployment
. So now I see the following options to create these two images:
Dokerfile.development
into my Dockerfile.deployment
, but use the r-base image in the FROM
statement. Drawback: I always need to keep multiple Dockerfiles up to date. If I add another image for testing, I have 3 Dockerfiles with 99% overlap. Another way is to first create a Dockerfile.deployment
with all requirements for the deployment. Then, the development image is built on top of the deployment image. Dockerfile.development
is more or less c/p the installation instructions in the Dockerfile for the RStudio image to add RStudio to the deployment image, but with the deplyoment image as base image. Drawback: I would not understand the code in my own Dockerfiles anymore.
Use multistage builds that make it easy to extract the built executables (or actually anything) from one image and use it into another one, without having to copy all the dependencies that were needed to build the executable. So my idea would be to extract the relevant files from the RStudio image into a new image that would be my deployment image.
I think the last option is preferred because it's the most modular solution and has the least duplication in the Dockerfiles and the lowest maintenance burden.
my narrow question is: Is there a (single) executable I could extract from the build RStudio image and put it on top of my deployment image?
my more open question is: How are people handling the situation where the development image is the deployment image plus some other tools that are available as standalone images and they want to avoid duplication as shown in the two first solutions under Candidate solutions.
Upvotes: 9
Views: 792
Reputation: 368519
tl;dr: You cannot. In the way you ask, methinks. Maybe you can do it differently.
Longer version:
.deb
filesHope this helps. Fill in any blanks where I got my assumptions wrong.
Upvotes: 2