Docker - Cache Python Packages to the Docker Host
Docker best practice:
Cache Python packages to the Docker host by mounting a volume or using BuildKit.
Example Dockerfile:
# Mount volume option -v $HOME/.cache/pip-docker/:/root/.cache/pip # BuildKit # syntax = docker/dockerfile:1.2 ... COPY requirements.txt . RUN --mount=type=cache,target=/root/.cache/pip \ pip install -r requirements.txt ...