|
|
|
|
|
by blackrobot
2328 days ago
|
|
Most Dockerfiles for python projects will have a line to install their python dependencies though. COPY requirements.txt ./
RUN pip install -r requirements.txt
If you're building the image on a CI server, docker can't cache that step because the files won't match the cache due to timestamps/permissions/etc... The same is true for other developer's machines.This is a problem if your requirements includes anything that uses C extensions, like mysql/postgresql libs or PIL. |
|
1. Using poetry which keeps a version lock file so all changes are reflected/cached, or
2. Doing a similar thing yourself by committing `pip freeze` and building images from that instead of requirements.txt.