Caching docker install requirements when using setup.cfg

Viewed 181

I'm currently trying to install a Python package as part of a Docker build. This Python package uses setup.cfg to store the metadata for its dependencies. With requirements.txt I'm able to cache the installation of the dependencies using something like:

COPY requirements.txt /app
RUN pip install -r requirements.txt

But this code is a pip-installable Python package that stores the dependency information in setup.cfg with a directory structure like this:

tree -L 2 .
.
├── mypy.ini
├── README.md
├── setup.cfg
├── setup.py
├── src
│   └── lib
├── tox.ini

Which is then installed like this:

COPY common /deps/common
RUN pip install file:///deps/common

Unfortunately this no longer caches the install of the requirements so any code change has to now go fetch and reinstall the python package dependencies each time. How do I cache the dependency installation specified by setup.cfg in a way that docker understands?

0 Answers
Related