-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
118 lines (97 loc) · 3.9 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# This Dockerfile has been modified from: https://github.com/StaPH-B/docker-builds/blob/master/samtools/1.18/Dockerfile
# We acknowledge and thank the authors for sharing their code:
# Shelby Bennett, Erin Young, Curtis Kapsak, & Kutluhan Incekara
ARG SAMTOOLS_VER="1.18"
ARG TBP_PARSER_VER="2.3.0"
FROM ubuntu:jammy AS builder
ARG SAMTOOLS_VER
# install dependencies required for compiling samtools
RUN apt-get update && apt-get install --no-install-recommends -y \
libncurses5-dev \
libbz2-dev \
liblzma-dev \
libcurl4-gnutls-dev \
zlib1g-dev \
libssl-dev \
gcc \
wget \
make \
perl \
bzip2 \
gnuplot \
ca-certificates
# download, compile, and install samtools
RUN wget https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VER}/samtools-${SAMTOOLS_VER}.tar.bz2 && \
tar -xjf samtools-${SAMTOOLS_VER}.tar.bz2 && \
cd samtools-${SAMTOOLS_VER} && \
./configure && \
make && \
make install
### start of app stage ###
FROM ubuntu:jammy AS app
ARG SAMTOOLS_VER
ARG TBP_PARSER_VER
LABEL base.image="ubuntu:jammy"
LABEL dockerfile.version="1"
LABEL software="tbp-parser"
LABEL software.version="2.1.1"
LABEL description="tbp-parser and samtools"
LABEL website="https://github.com/theiagen/tbp-parser"
LABEL license="https://github.com/theiagen/tbp-parser/blob/main/LICENSE"
LABEL maintainer="Curtis Kapsak"
LABEL maintainer.email="[email protected]"
LABEL maintainer2="Sage Wright"
LABEL maintainer2.email="[email protected]"
ARG DEBIAN_FRONTEND=noninteractive
# install dependencies required for running samtools
# 'gnuplot' required for plot-ampliconstats
RUN apt-get update && apt-get install --no-install-recommends -y \
python3 \
python3-pip \
perl \
zlib1g \
libncurses5 \
bzip2 \
liblzma-dev \
libcurl4-gnutls-dev \
gnuplot \
wget \
ca-certificates \
&& apt-get autoclean && rm -rf /var/lib/apt/lists/*
# copy in samtools executables from builder stage
COPY --from=builder /usr/local/bin/* /usr/local/bin/
ENV LC_ALL=C
# copy in all of the tb-profiler-parsing code
RUN wget https://github.com/theiagen/tbp-parser/archive/refs/tags/v${TBP_PARSER_VER}.tar.gz && \
tar -xzvf v${TBP_PARSER_VER}.tar.gz && \
mv -v tbp-parser-${TBP_PARSER_VER} /tbp-parser
ENV DEB_PYTHON_INSTALL_LAYOUT=deb_system
# install python dependencies and parsing scripts
# updating setuptools because the version in apt for ubuntu:jammy is a bit old
# just using a requrements.txt file for now; pyproject.toml is the current recommended approach, but I'm not too familiar with it
RUN cd /tbp-parser && \
python3 -m pip install 'setuptools==68.2.0' && \
python3 -m pip install -r requirements.txt
# final working directory is /data
WORKDIR /data
# default command is to pull up help options
CMD [ "python3", "/tbp-parser/tbp_parser/tbp_parser.py", "--help"]
### start of test stage ###
FROM app AS test
# # install wget for downloading test files
RUN apt-get update && apt-get install --no-install-recommends -y wget ca-certificates
RUN wget -q https://raw.githubusercontent.com/StaPH-B/docker-builds/master/tests/SARS-CoV-2/SRR13957123.consensus.fa && \
wget -q https://raw.githubusercontent.com/StaPH-B/docker-builds/master/tests/SARS-CoV-2/SRR13957123.primertrim.sorted.bam && \
wget -q https://raw.githubusercontent.com/artic-network/artic-ncov2019/master/primer_schemes/nCoV-2019/V3/nCoV-2019.primer.bed && \
samtools stats SRR13957123.primertrim.sorted.bam && \
samtools faidx SRR13957123.consensus.fa && \
samtools ampliconstats nCoV-2019.primer.bed SRR13957123.primertrim.sorted.bam > SRR13957123_ampliconstats.txt && \
plot-ampliconstats plot SRR13957123_ampliconstats.txt && \
ls
# test version and help option outputs
# run pytest suite
RUN python3 /tbp-parser/tbp_parser/tbp_parser.py --version && \
python3 /tbp-parser/tbp_parser/tbp_parser.py --help && \
python3 -m pip install pytest && \
cd /tbp-parser && \
pytest