Mike Huls
1 min readMar 8, 2022

--

He Yusuf,

Thanks for the compliment, great to hear you enjoy!

In this article i've split the COPY _submodules/toolbox and the COPY . (everything source code) into two parts. Technically the COPY . already copies the submodules over to the Docker image but i've decided to keep the COPY _submodules to keep the code more clear.

Once the _submodules/toolbox folder is copied we install the submodule using pip. Pip then installs the submodule into the environment of the docker image. At this point the image knows about the existence of toolbox. In the next step we copy our source code to the image. This source code references toolbox (we can now import toolbox)

I'm thinking about your specific problem and i'm not sure if I understand.

A possible solution could be to adjust your dockerfile a bit. In this article we use a two-stage build in Docker. In the first stage we create a virtual environment and install all packages in there. Then we copy over the entire venv to the final image layer.

Another solution may be to extend your coworkers image, by including a git clone in the Dockerfile that pulls your repo?

Hope this helps!

--

--

Mike Huls
Mike Huls

Written by Mike Huls

I write about interesting programming-related things: techniques, system architecture, software design and how to apply them in the best way. — mikehuls.com

No responses yet