Skip to content

Commit

Permalink
Reduced gatk base image layers from 20 to just 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpalis committed May 7, 2024
1 parent 5b47bc2 commit 4cb0c68
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions scripts/docker/gatkbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# NOTE: If you update the ubuntu version make sure to update the samtools/bcftools/bedtools versions in the README
FROM ubuntu:22.04

# Set environment variables.
# Avoid interactive prompts during apt installs/upgrades
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND="noninteractive" HOME="/root" JAVA_LIBRARY_PATH="/usr/lib/jni" DOWNLOAD_DIR="/downloads" CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh" CONDA_SHA256="c7a34df472feb69805b64df6e8db58363c5ccab41cd3b40b07e3e6dfb924359a" CONDA_PATH="/opt/miniconda" PATH="/opt/miniconda/bin:$PATH"

# Define working directory.
WORKDIR /root

#### Basic image utilities
#### Basic image utilities, google cloud support, and miniconda
RUN apt update && \
apt full-upgrade -y && \
apt install -y --no-install-recommends \
Expand All @@ -32,12 +36,9 @@ RUN apt update && \
apt -y clean && \
apt -y autoclean && \
apt -y autoremove && \
rm -rf /var/lib/apt/lists/*

RUN java -version

#### Specific for google cloud support
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" \
rm -rf /var/lib/apt/lists/* && \
java -version && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" \
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt update -y && \
Expand All @@ -49,26 +50,8 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
# Remove the anthos cli tool and related files since they are very large and we / anyone using the docker are unlikely to use them
# Remove the bundled python because we have python installed separately
rm -rf /usr/lib/google-cloud-sdk/bin/anthoscli /usr/lib/google-cloud-sdk/platform/anthoscli_licenses /usr/lib/google-cloud-sdk/platform/bundledpythonunix && \
find / -wholename "*__pycache__/*.pyc" -exec rm {} +

# Set environment variables.
ENV HOME /root

# Define working directory.
WORKDIR /root

# Define default command.
CMD ["bash"]

ENV JAVA_LIBRARY_PATH /usr/lib/jni

# Install miniconda
ENV DOWNLOAD_DIR /downloads
ENV CONDA_URL https://repo.anaconda.com/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh
ENV CONDA_SHA256 "c7a34df472feb69805b64df6e8db58363c5ccab41cd3b40b07e3e6dfb924359a"
ENV CONDA_PATH /opt/miniconda
ENV PATH $CONDA_PATH/bin:$PATH
RUN mkdir $DOWNLOAD_DIR && \
find / -wholename "*__pycache__/*.pyc" -exec rm {} + && \
mkdir $DOWNLOAD_DIR && \
wget -nv -O $DOWNLOAD_DIR/miniconda.sh $CONDA_URL && \
test "$(sha256sum $DOWNLOAD_DIR/miniconda.sh | awk -v FS=' ' -v ORS='' '{print $1}')" = "$CONDA_SHA256" && \
bash $DOWNLOAD_DIR/miniconda.sh -p $CONDA_PATH -b && \
Expand All @@ -77,3 +60,26 @@ RUN mkdir $DOWNLOAD_DIR && \
conda config --set auto_update_conda false && \
conda config --set solver libmamba && \
rm -rf /root/.cache/pip

# Set environment variables.
# ENV HOME /root

# ENV JAVA_LIBRARY_PATH /usr/lib/jni

# Install miniconda
# ENV DOWNLOAD_DIR /downloads
# ENV CONDA_URL https://repo.anaconda.com/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh
# ENV CONDA_SHA256 "c7a34df472feb69805b64df6e8db58363c5ccab41cd3b40b07e3e6dfb924359a"
# ENV CONDA_PATH /opt/miniconda
# ENV PATH $CONDA_PATH/bin:$PATH
# RUN mkdir $DOWNLOAD_DIR && \
# wget -nv -O $DOWNLOAD_DIR/miniconda.sh $CONDA_URL && \
# test "$(sha256sum $DOWNLOAD_DIR/miniconda.sh | awk -v FS=' ' -v ORS='' '{print $1}')" = "$CONDA_SHA256" && \
# bash $DOWNLOAD_DIR/miniconda.sh -p $CONDA_PATH -b && \
# rm $DOWNLOAD_DIR/miniconda.sh && \
# conda clean -afy && \
# conda config --set auto_update_conda false && \
# conda config --set solver libmamba && \
# rm -rf /root/.cache/pip
# Define default command.
CMD ["bash"]

0 comments on commit 4cb0c68

Please sign in to comment.