0

I have a custom docker image that i work upon. The dockerfile i created starts with

FROM ubuntu

Now, i want to add cadquery to my packages. Hopefully, there is a dockerfile for doing that. Here it is:

FROM continuumio/miniconda3
RUN apt install -y libgl1-mesa-glx
RUN conda install conda-build
RUN apt-get install -y git
WORKDIR /
RUN git clone https://github.com/cadquery/cadquery.git
WORKDIR /cadquery
RUN conda env create -n cq -f environment.yml
RUN echo "source activate cq" > ~/.bashrc
ENV PATH /opt/conda/envs/cq/bin:$PATH
WORKDIR /testing

(source: https://github.com/RubenRubens/cq-testing/blob/master/Dockerfile)

However, as you can see, it uses a different FROM command than mine. What i want to do, is keep my dockerfile, and just add conda, and cadquery somehow.

I researched a bit into the continuumio/miniconda3 image, but i am to sure what is the best startegy to use after all.

I know that you can have two different FROM commands in your dockerfile, but is this recommended?

If yes, how the structure of the dockerfile should be?

IF no, meaning it is NOT recommended to use two different FROM commands, how should i structure my dockerfile?

Should i use the FROM ubuntu dockerfile, and just add conda manually, and then proceed like this dockerfile i pasted here?

EDIT: I forgot to say that one important thing to note, is that miniconda is installed from a .sh file that you download (source: https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html)

So i am not sure if using two FROM commands (and how), or just having the basic ubuntu image and downloading that .sh would work best.

user1584421
  • 3,499
  • 11
  • 46
  • 86
  • This is something that you surely can do if you need it, see the documentation of [multistage-build](https://docs.docker.com/develop/develop-images/multistage-build/). – Flo Mar 31 '21 at 16:13
  • 1
    There is no way to merge two different images. Having two separate `FROM` lines will create two separate images and in effect only the last one is used. If that Miniconda image is based on Ubuntu (or Debian) you should be able to `RUN` the same commands, though. – David Maze Mar 31 '21 at 16:36

0 Answers0