-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
74 lines (56 loc) · 2.33 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
# start with an image with conda installed
FROM condaforge/mambaforge AS compile-image
# set working directory
WORKDIR /data
# check for updates
RUN apt-get update -y && \
apt-get upgrade -y && \
apt install build-essential -y --no-install-recommends && \
apt-get clean && apt-get autoclean
# copy in piranha
RUN git clone https://github.com/polio-nanopore/piranha.git && \
cd /data/piranha && \
mamba install conda -n base -c conda-forge -c defaults -c bioconda && \
mamba env create -f /data/piranha/environment.yml
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "piranha", "/bin/bash", "-c"]
RUN mamba install -c conda-forge -n piranha python=3.10 conda-pack && \
cd /data/piranha && \
pip install .
# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda list && \
conda-pack -n piranha -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar && /venv/bin/conda-unpack
SHELL ["/bin/bash", "-c"]
RUN conda clean --all &&\
conda remove --name piranha --all
# build piranha
WORKDIR /data/piranha
RUN source /venv/bin/activate && pip install --user --no-cache-dir . \
&& pip uninstall -y tensorflow keras pyabpoa \
&& conda install -y -c conda-forge tensorflow~=2.11 keras~=2.11
# test piranha runs while have data before creating runtime image
RUN source /venv/bin/activate && piranha -h && piranha -i /data/piranha/test_data/demultiplexed -b /data/piranha/test_data/barcodes.csv
# build image
FROM debian:bullseye-slim AS runtime-image
COPY --from=compile-image /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
# Copy /venv from the previous stage:
COPY --from=compile-image /venv /venv
# create directory to mount the basecalled directory and output directory
RUN mkdir -p /data/run_data/basecalled && mkdir -p /data/run_data/output
# check for updates
RUN apt-get update -y && \
apt-get upgrade -y && \
apt install build-essential -y --no-install-recommends && \
apt install -y procps && \
apt-get clean && apt-get autoclean
WORKDIR /data/run_data/analysis
SHELL ["/bin/bash", "-c"]
# to allow streamed log output
ENV PYTHONUNBUFFERED=1
ENV PATH=/venv/bin:$PATH
CMD source /venv/bin/activate && \
piranha -b /data/run_data/analysis/barcodes.csv -i /data/run_data/basecalled --outdir /data/run_data/output/piranha_output -t ${THREADS}