1+ # for easy upgrade later. ARG variables only persist during build time
2+ ARG HTSLIB_VER="1.21"
3+
4+ FROM ubuntu:jammy as builder
5+
6+ ARG HTSLIB_VER
7+
8+ # install dependencies, cleanup apt garbage
9+ # It's helpful when they're all listed on https://github.com/samtools/htslib/blob/develop/INSTALL
10+ RUN apt-get update && apt-get install --no-install-recommends -y \
11+ wget \
12+ ca-certificates \
13+ make \
14+ bzip2 \
15+ autoconf \
16+ automake \
17+ make \
18+ gcc \
19+ perl \
20+ zlib1g-dev \
21+ libbz2-dev \
22+ liblzma-dev \
23+ libcurl4-gnutls-dev \
24+ libssl-dev \
25+ libdeflate-dev \
26+ procps && \
27+ rm -rf /var/lib/apt/lists/* && apt-get autoclean
28+
29+ # get htslib, compile, install, run test suite
30+ RUN wget -q https://github.com/samtools/htslib/releases/download/${HTSLIB_VER}/htslib-${HTSLIB_VER}.tar.bz2 && \
31+ tar -vxjf htslib-${HTSLIB_VER}.tar.bz2 && \
32+ rm -v htslib-${HTSLIB_VER}.tar.bz2 && \
33+ cd htslib-${HTSLIB_VER} && \
34+ ./configure && \
35+ make && \
36+ make install && \
37+ make test
38+
39+ # ## start of app stage ###
40+ FROM ubuntu:jammy as app
41+
42+ ARG HTSLIB_VER
43+
44+ LABEL base.image="ubuntu:jammy"
45+ LABEL dockerfile.version="1"
46+ LABEL software="htslib"
47+ LABEL software.version="${HTSLIB_VER}"
48+ LABEL description="A C library for reading/writing high-throughput sequencing data"
49+ LABEL website="https://github.com/samtools/htslib"
50+ LABEL license="https://github.com/samtools/htslib/blob/develop/LICENSE"
51+ LABEL maintainer="Erin Young"
52+ LABEL maintainer.email="eriny@utah.gov"
53+ LABEL maintainer2="Curtis Kapsak"
54+ LABEL maintainer2.email="kapsakcj@gmail.com"
55+
56+ # install runtime dependencies & cleanup apt garbage
57+ # installed as recommend here: https://github.com/samtools/htslib/blob/develop/INSTALL#L31
58+ RUN apt-get update && apt-get install --no-install-recommends -y \
59+ bzip2 \
60+ zlib1g \
61+ libbz2-1.0 \
62+ liblzma5 \
63+ libcurl3-gnutls \
64+ libdeflate0 \
65+ ca-certificates \
66+ && apt-get autoclean && rm -rf /var/lib/apt/lists/*
67+
68+ # copy in htslib executables from builder stage
69+ COPY --from=builder /usr/local/bin/* /usr/local/bin/
70+ COPY --from=builder /usr/local/lib/ /usr/local/lib/
71+ COPY --from=builder /usr/local/include/ /usr/local/include/
72+
73+ # set locale settings for singularity compatibility
74+ ENV LC_ALL=C
75+
76+ # set working directory
77+ WORKDIR /data
78+
79+ # default command is to show help options
80+ CMD ["htsfile" , "--help" ]
81+
82+ # ## start of test stage ###
83+ FROM app as test
84+
85+ # check that these three executables are available
86+ RUN bgzip --help && tabix --help && htsfile --help
87+
88+ RUN apt-get update && apt-get install --no-install-recommends -y wget
89+
90+ # use on actual files
91+ RUN wget -q https://github.com/StaPH-B/docker-builds/raw/master/tests/SARS-CoV-2/SRR13957123_1.fastq.gz && \
92+ gunzip SRR13957123_1.fastq.gz && \
93+ bgzip SRR13957123_1.fastq
94+
95+ # FYI Test suite "make test" now performed in the builder stage since app and
96+ # test stages do not include htslib source code.
97+ # This is to avoid having to re-download source code simply to run test suite
0 commit comments