Skip to content

Commit 42fa14d

Browse files
committed
update base image from 22.04 to 24.04; install more dependencies; support requester-pays; better makefile
1 parent b048045 commit 42fa14d

3 files changed

Lines changed: 35 additions & 12 deletions

File tree

docker/lr-gcloud-samtools/Dockerfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# then support both gsutil and gcloud CLIs
33

44
############### stage 0: build samtools and bcftools from source
5-
FROM ubuntu:20.04
5+
FROM ubuntu:24.04 AS builder
66

77
ARG DEBIAN_FRONTEND=noninteractive
8-
ARG SAMTOOLS_VERSION=1.18
9-
ARG BCFTOOLS_VERSION=1.18
8+
ARG SAMTOOLS_VERSION=1.23
9+
ARG BCFTOOLS_VERSION=1.23
1010
RUN apt-get -qqy update --fix-missing && \
1111
apt-get -qqy dist-upgrade && \
1212
apt-get -qqy install --no-install-recommends \
@@ -27,14 +27,14 @@ RUN apt-get -qqy update --fix-missing && \
2727
tar xjf samtools-${SAMTOOLS_VERSION}.tar.bz2 && \
2828
cd samtools-${SAMTOOLS_VERSION} \
2929
&& ./configure --without-curses --enable-libcurl --with-libdeflate \
30-
&& make -s all all-htslib \
30+
&& make -j 4 -s all all-htslib \
3131
&& make install install-htslib && \
3232
cd - && rm -rf samtools-${SAMTOOLS_VERSION}* && \
3333
wget https://github.com/samtools/bcftools/releases/download/${BCFTOOLS_VERSION}/bcftools-${BCFTOOLS_VERSION}.tar.bz2 && \
3434
tar xjf bcftools-${BCFTOOLS_VERSION}.tar.bz2 && \
3535
cd bcftools-${BCFTOOLS_VERSION} \
3636
&& ./configure --without-curses \
37-
&& make -s \
37+
&& make -j 4 -s \
3838
&& make install && \
3939
cd - && rm -rf bcftools-${BCFTOOLS_VERSION}* && \
4040
apt-get -qqy purge autoconf automake bzip2 gcc make wget && \
@@ -49,21 +49,26 @@ RUN apt-get -qqy update --fix-missing && \
4949
bcftools --help
5050

5151
############### stage 1: other commonly used bioinformatics utilities
52-
FROM ubuntu:20.04
52+
FROM ubuntu:24.04
5353

5454
ENV HOME=/root
5555

5656
# Define default command.
5757
CMD ["bash"]
5858

5959
# copy from previous stage the binaries from samtools build
60-
COPY --from=0 /usr/local/bin/* /usr/local/bin/
60+
COPY --from=builder /usr/local/bin/* /usr/local/bin/
61+
COPY --from=builder /usr/local/libexec/bcftools /usr/local/libexec/bcftools
6162

6263
#### Basic utilities
6364
ARG DEBIAN_FRONTEND=noninteractive
6465
RUN apt-get -qqy update --fix-missing && \
6566
apt-get -qqy dist-upgrade && \
6667
apt-get -qqy install --no-install-recommends \
68+
libcurl4t64 \
69+
libdeflate0 \
70+
liblzma5 \
71+
libbz2-1.0 \
6772
apt-transport-https \
6873
ca-certificates \
6974
gnupg \
@@ -74,6 +79,7 @@ RUN apt-get -qqy update --fix-missing && \
7479
datamash \
7580
gawk \
7681
less \
82+
rename \
7783
pigz \
7884
tabix \
7985
tree \
@@ -98,4 +104,4 @@ RUN apt-get -qqy update --fix-missing && \
98104
bcftools --version
99105

100106

101-
COPY re-auth.sh /opt/
107+
COPY re-auth.sh /opt/

docker/lr-gcloud-samtools/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
VERSION = 0.1.3
1+
VERSION = 0.1.23
22
TAG1 = us.gcr.io/broad-dsp-lrma/lr-gcloud-samtools:$(VERSION)
33
TAG2 = us.gcr.io/broad-dsp-lrma/lr-gcloud-samtools:latest
44

5+
ARCH := $(shell uname -m)
6+
BUILDER_NAME := lr-builder
7+
8+
# Set platform flag only when needed
9+
ifeq ($(ARCH), arm64)
10+
PLATFORM_FLAG := --platform linux/amd64
11+
else
12+
PLATFORM_FLAG :=
13+
endif
14+
15+
.PHONY: all build push
16+
517
all: build push
618

719
build:
8-
docker build -t $(TAG1) -t $(TAG2) .
20+
@docker buildx inspect $(BUILDER_NAME) > /dev/null 2>&1 || \
21+
docker buildx create --name $(BUILDER_NAME) --use
22+
@docker buildx use $(BUILDER_NAME)
23+
docker buildx build $(PLATFORM_FLAG) \
24+
--load \
25+
-t $(TAG1) -t $(TAG2) .
926

1027
push:
1128
docker push $(TAG1)

docker/lr-gcloud-samtools/re-auth.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
set -eu
44

5-
export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token`
6-
5+
export GCS_OAUTH_TOKEN=$(gcloud auth application-default print-access-token)
6+
export GCS_REQUESTER_PAYS_PROJECT=$(gcloud config get-value project)

0 commit comments

Comments
 (0)