Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a docker image to be used for creating Terra cloud environment #421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
112 changes: 112 additions & 0 deletions terra/custom_env_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
############### stage 0: build samtools and bcftools from source
FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
ARG SAMTOOLS_VERSION=1.18
ARG BCFTOOLS_VERSION=1.18
RUN apt-get -qqy update --fix-missing && \
apt-get -qqy dist-upgrade && \
apt-get -qqy install --no-install-recommends \
ca-certificates \
libbz2-dev \
libcurl4-openssl-dev \
liblzma-dev \
libncurses5-dev \
autoconf \
automake \
bzip2 \
gcc \
make \
wget \
zlib1g-dev && \
wget https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2 && \
tar xjf samtools-${SAMTOOLS_VERSION}.tar.bz2 && \
cd samtools-${SAMTOOLS_VERSION} && ./configure --without-curses --enable-libcurl && make -s all all-htslib && make install install-htslib && cd - && \
rm -rf samtools-${SAMTOOLS_VERSION}* && \
wget https://github.com/samtools/bcftools/releases/download/${BCFTOOLS_VERSION}/bcftools-${BCFTOOLS_VERSION}.tar.bz2 && \
tar xjf bcftools-${BCFTOOLS_VERSION}.tar.bz2 && \
cd bcftools-${BCFTOOLS_VERSION} && ./configure --without-curses && make -s && make install && cd - && \
rm -rf bcftools-${BCFTOOLS_VERSION}* && \
apt-get -qqy purge autoconf automake bzip2 gcc make wget && \
apt-get -qqy clean && \
rm -rf /tmp/* \
/var/tmp/* \
/var/cache/apt/* \
/var/lib/apt/lists/* \
/usr/share/man/?? \
/usr/share/man/??_* && \
samtools --help && \
bcftools --help

############### stage 1: other commonly used bioinformatics utilities
FROM us.gcr.io/broad-dsde-methods/terra-jupyter-minimal-base:0.0.1

USER root

# copy from previous stage the binaries from samtools build
COPY --from=0 /usr/local/bin/* /usr/local/bin/

ARG lrmaCU="https://github.com/broadinstitute/lrma-cloud-utils.git"
ARG MINIMAP2_VERSION='2.26'
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -qqy update --fix-missing && \
apt-get -qqy dist-upgrade && \
apt-get -qqy install --no-install-recommends \
apt-transport-https \
ca-certificates \
gnupg \
zlib1g-dev \
aria2 \
bc \
bedtools \
bzip2 \
cron \
curl \
datamash \
gawk \
less \
python3.10 \
python3-pip \
tabix \
tmux \
tree \
vcftools \
wget && \
gcloud components update --quiet && \
cd /tmp && \
curl -L https://github.com/lh3/minimap2/releases/download/v${MINIMAP2_VERSION}/minimap2-${MINIMAP2_VERSION}_x64-linux.tar.bz2 | tar -jxvf - && \
cd minimap2-${MINIMAP2_VERSION}_x64-linux && \
mv k8 minimap2 paftools.js /usr/local/bin/ && \
apt-get -qqy clean && \
rm -rf /tmp/* \
/var/tmp/* \
/var/cache/apt/*

# key library
RUN python3 -m pip install --upgrade pip setuptools ipynbname && \
python3 -m pip install --upgrade \
git+${lrmaCU}

# terminal-customization
RUN cd /home/jupyter/ && \
git clone \
--depth=1 \
https://github.com/Bash-it/bash-it.git /home/jupyter/.bash_it && \
cd /home/jupyter/.bash_it && \
bash install.sh --silent && \
cd -

# cron-related
RUN echo 'jupyter' >> /etc/cron.allow && \
echo 'jupyter' >> /etc/at.allow && \
chmod u+s /usr/sbin/cron

# sendgrid for email notification
RUN apt-get -qqy update --fix-missing && \
apt-get -qqy dist-upgrade && \
apt-get -qqy install --no-install-recommends \
postfix libsasl2-modules mailutils && \
apt-get -qqy clean && \
rm -rf /tmp/* \
/var/tmp/* \
/var/cache/apt/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about other common cloud utilities, such as gsutil? Does the terra base image include that?

FYI, this is how I usually install it so crcmod works and parallel uploads/downloads are fast:

# install gsutil
RUN apt-get --allow-releaseinfo-change update
RUN apt install -y curl git-lfs time datamash
RUN curl https://sdk.cloud.google.com | bash

# Setup crcmodc for gsutil:
RUN apt-get install -y gcc python3-dev python3-setuptools && \
			pip3 uninstall -y crcmod && \
			pip3 install --no-cache-dir -U crcmod

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you're right. The base image I depend on handles the google cloud stuff.
I don't want to mess with that, other than that line which updates the google cloud cli.

12 changes: 12 additions & 0 deletions terra/custom_env_docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
VERSION = 0.0.1
TAG1 = us.gcr.io/broad-dsp-lrma/lr-terra-base:$(VERSION)
TAG2 = us.gcr.io/broad-dsp-lrma/lr-terra-base:latest

all: build push

build:
docker build -t $(TAG1) -t $(TAG2) .

push:
docker push $(TAG1)
docker push $(TAG2)