Skip to content

Commit a150293

Browse files
committed
Add ~/.cache/pip as a mounted cache, removes ~3GB of data from the image
1 parent 0b6773a commit a150293

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docker/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ COPY . ./
185185

186186
RUN --mount=type=cache,id=workspace_cache,target=/workspace/.cache,sharing=locked \
187187
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
188+
--mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
188189
# Install git-lfs before running the build to avoid errors during conda build
189190
/opt/conda/bin/mamba install -y -n base -c conda-forge "git-lfs" &&\
190191
source activate base &&\
@@ -227,6 +228,7 @@ COPY ${MORPHEUS_ROOT_HOST}/conda/environments/dev_cuda-${CUDA_MAJOR_VER}${CUDA_M
227228

228229
# Update the morpheus environment
229230
RUN --mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
231+
--mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
230232
# Temp add channel_alias to get around conda 404 errors
231233
conda config --env --set channel_alias ${CONDA_CHANNEL_ALIAS} &&\
232234
/opt/conda/bin/conda env update --solver=libmamba -n morpheus --file conda/environments/dev.yaml &&\
@@ -263,6 +265,7 @@ COPY . ./
263265

264266
RUN --mount=type=cache,id=workspace_cache,target=/workspace/.cache,sharing=locked \
265267
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
268+
--mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
266269
# Install git-lfs before running the build to avoid errors during conda build
267270
/opt/conda/bin/mamba install -y -n base -c conda-forge "git-lfs" &&\
268271
source activate base &&\
@@ -285,6 +288,7 @@ COPY . ./
285288
RUN --mount=type=cache,id=workspace_cache,target=/workspace/.cache,sharing=locked \
286289
--mount=type=bind,from=conda_bld_morpheus,source=/opt/conda/conda-bld,target=/opt/conda/conda-bld \
287290
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
291+
--mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
288292
source activate morpheus &&\
289293
CONDA_ALWAYS_YES=true /opt/conda/bin/mamba install -n morpheus \
290294
-c local \
@@ -314,6 +318,7 @@ COPY "${MORPHEUS_ROOT_HOST}/conda/environments/runtime_cuda-${CUDA_MAJOR_VER}${C
314318
# Mount Morpheus conda package build in `conda_bld_morpheus`
315319
RUN --mount=type=bind,from=conda_bld_morpheus,source=/opt/conda/conda-bld,target=/opt/conda/conda-bld \
316320
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
321+
--mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
317322
# CVE-2018-20225 for the base pip, not the env one
318323
# conda will ignore the request to remove pip
319324
python -m pip uninstall -y pip && \

0 commit comments

Comments
 (0)