Skip to content

Commit dd55b4a

Browse files
dpark01claude
andcommitted
Nuke conda pkgs cache after install to eliminate cached JAR/binary CVEs
micromamba clean --all leaves extracted packages in /opt/conda/pkgs/ because installed files are hardlinked from there. Trivy scans the full filesystem and flags CVEs in cached JARs (picard, fgbio, snpeff) and binaries. Adding rm -rf /opt/conda/pkgs/* to install-conda-deps.sh eliminates all cache copies in one place. Removed per-file pkgs cache deletions from Dockerfiles since the script now handles it centrally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ae16749 commit dd55b4a

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

docker/Dockerfile.assemble

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ COPY docker/install-conda-deps.sh /tmp/
3232
# never use --dash mode; delete inline so it never appears in any layer.
3333
RUN /tmp/install-conda-deps.sh /tmp/requirements/baseimage.txt /tmp/requirements/core.txt /tmp/requirements/assemble.txt \
3434
--x86-only:/tmp/requirements/assemble-x86.txt && \
35-
rm -f /opt/conda/libexec/mafft/dash_client && \
36-
rm -f /opt/conda/pkgs/*/libexec/mafft/dash_client
35+
rm -f /opt/conda/libexec/mafft/dash_client
3736

3837
# Copy source code (includes assembly module)
3938
COPY src/ /opt/viral-ngs/source/src/

docker/Dockerfile.baseimage

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ COPY docker/install-conda-deps.sh /tmp/
6363
# Remove gcloud-crc32c — Go binary compiled with old Go stdlib (CVEs).
6464
# gcloud/gsutil use the conda environment Python, not the bundled one.
6565
RUN /tmp/install-conda-deps.sh /tmp/requirements/baseimage.txt && \
66-
rm -rf /opt/conda/pkgs/google-cloud-sdk-*/share/google-cloud-sdk-*/platform/bundledpythonunix && \
6766
rm -rf /opt/conda/share/google-cloud-sdk-*/platform/bundledpythonunix && \
6867
rm -f /opt/conda/share/google-cloud-sdk-*/bin/gcloud-crc32c && \
69-
rm -f /opt/conda/pkgs/google-cloud-sdk-*/share/google-cloud-sdk-*/bin/gcloud-crc32c && \
7068
rm -rf /tmp/requirements /tmp/install-conda-deps.sh
7169

7270
# Install firecloud via pip instead of conda because the conda noarch

docker/Dockerfile.mega

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ RUN /tmp/install-conda-deps.sh /tmp/requirements/baseimage.txt /tmp/requirements
3131
--x86-only:/tmp/requirements/assemble-x86.txt \
3232
--x86-only:/tmp/requirements/classify-x86.txt \
3333
--x86-only:/tmp/requirements/phylo-x86.txt && \
34-
rm -f /opt/conda/libexec/mafft/dash_client && \
35-
rm -f /opt/conda/pkgs/*/libexec/mafft/dash_client
34+
rm -f /opt/conda/libexec/mafft/dash_client
3635

3736
# Copy source code (includes all modules)
3837
COPY src/ /opt/viral-ngs/source/src/

docker/Dockerfile.phylo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ COPY docker/install-conda-deps.sh /tmp/
2929
# never use --dash mode; delete inline so it never appears in any layer.
3030
RUN /tmp/install-conda-deps.sh /tmp/requirements/baseimage.txt /tmp/requirements/core.txt /tmp/requirements/phylo.txt \
3131
--x86-only:/tmp/requirements/phylo-x86.txt && \
32-
rm -f /opt/conda/libexec/mafft/dash_client && \
33-
rm -f /opt/conda/pkgs/*/libexec/mafft/dash_client
32+
rm -f /opt/conda/libexec/mafft/dash_client
3433

3534
# Copy source code (includes phylo module)
3635
COPY src/ /opt/viral-ngs/source/src/

docker/install-conda-deps.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ echo ""
114114
echo "Installed packages:"
115115
micromamba list
116116

117-
# Clean up
117+
# Clean up: micromamba clean removes tarballs and index cache, but leaves
118+
# extracted packages in /opt/conda/pkgs/ for hardlink-installed files.
119+
# Trivy scans the full filesystem and flags CVEs in cached JARs/binaries,
120+
# so we nuke the entire pkgs cache to avoid false positives.
118121
micromamba clean -y --all
122+
rm -rf /opt/conda/pkgs/*
119123

120124
echo ""
121125
echo "Done installing conda dependencies."

0 commit comments

Comments
 (0)