Skip to content

Commit

Permalink
Slim down docker images.
Browse files Browse the repository at this point in the history
This removes deepvariant from the image, for the time being.  For some reason
these images have ballooned in size since the last time we built them, and
that is stopping them from being successfully uploaded to quay.

Summary of changes to reduce image sizes:

- remove deepvariant
- remove .a and .pyc files from image
- use conda clean -fay to more aggressive clean up after conda.
  • Loading branch information
roryk committed Nov 24, 2020
1 parent f21035a commit 9e5bbb9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build bcbio base image with code and framework

#FROM continuumio/miniconda
FROM ubuntu:18.04
LABEL maintainer="bcbio (https://github.com/bcbio/bcbio-nextgen)"
ARG git_revision=master
Expand All @@ -17,7 +18,7 @@ RUN apt-get update && \
https://raw.github.com/chapmanb/bcbio-nextgen/master/scripts/bcbio_nextgen_install.py && \
python bcbio_nextgen_install.py /usr/local/share/bcbio-nextgen \
--isolate --minimize-disk --nodata -u development --revision "$git_revision" && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda install -y nomkl && \
# /usr/local/share/bcbio-nextgen/anaconda/bin/conda install -y nomkl && \
/usr/local/share/bcbio-nextgen/anaconda/bin/bcbio_nextgen.py upgrade -u development --revision "$git_revision" && \
# add user run script
wget --no-check-certificate -O createsetuser \
Expand All @@ -30,7 +31,8 @@ RUN apt-get update && \
cd /usr/local && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/tmp/* && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda clean --yes --tarballs --packages && \
# /usr/local/share/bcbio-nextgen/anaconda/bin/conda clean --yes --tarballs --packages && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda clean -afy && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda build purge-all && \
rm -rf /usr/local/share/bcbio-nextgen/anaconda/pkgs/qt* && \
rm -rf /usr/local/share/bcbio-nextgen/anaconda/pkgs/scipy-0.19.1-np113py27_nomkl_0 && \
Expand All @@ -53,6 +55,10 @@ RUN apt-get update && \
# Ensure permissions are set for update in place by arbitrary users
find /usr/local -perm /u+x -execdir chmod a+x {} \; && \
find /usr/local -perm /u+w -execdir chmod a+w {} \; && \
# remove unneeded files .a .pyc
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.pyc" -delete && \
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.a" -delete && \
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.js.map" -delete && \
# Ensure permissions for updating for users not present in /etc/passwd
# https://blog.openshift.com/jupyter-on-openshift-part-6-running-as-an-assigned-user-id/
chmod a+w /etc/passwd
10 changes: 8 additions & 2 deletions Dockerfile.tools
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ RUN mkdir -p /tmp/bcbio-nextgen-install && cd /tmp/bcbio-nextgen-install && \
/usr/local/share/bcbio-nextgen/anaconda/bin/bcbio_nextgen.py upgrade --isolate \
--tooldir=/usr/local --tools --toolconf /"$tool".yaml && \
cd /usr/local && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda clean --yes --tarballs && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda clean -afy && \
/usr/local/share/bcbio-nextgen/anaconda/bin/conda build purge-all && \
rm -rf /usr/local/share/bcbio-nextgen/anaconda/pkgs/scipy-0.19.1-np113py27_nomkl_0 && \
rm -rf /usr/local/share/bcbio-nextgen/anaconda/zulu*.tar.gz && \
rm -rf /tmp/bcbio-nextgen-install
rm -rf /tmp/bcbio-nextgen-install && \
rm -rf bcbio-vc.yaml && \
rm -rf bcbio_nextgen_install.py && \
rm -rf bcbiotx && \
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.pyc" -delete && \
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.a" -delete && \
find /usr/local/share/bcbio-nextgen -follow -type f -name "*.js.map" -delete
2 changes: 1 addition & 1 deletion build_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -ex -o pipefail
TAG="${BCBIO_VERSION}-${BCBIO_REVISION}"

# build bcbio base
docker pull ubuntu:16.04
docker pull ubuntu:18.04
docker build --no-cache --build-arg "git_revision=${BCBIO_REVISION}" -t "${NS}/bcbio-base:${TAG}" -t "${NS}/bcbio-base:latest" - < Dockerfile.base

# log in to quay.io
Expand Down
4 changes: 2 additions & 2 deletions packages/bcbio-vc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bio_nextgen:
- atropos;env=python3
- atropos
- bcbio-prioritize
- bcbio-variation-recall
- bcftools
Expand All @@ -10,7 +10,7 @@ bio_nextgen:
- bwakit
- cnvkit
- coincbc
- deepvariant;env=dv
#- deepvariant;env=dv
- delly
- duphold
- extract-sv-reads
Expand Down

0 comments on commit 9e5bbb9

Please sign in to comment.