-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
90 lines (70 loc) · 2.68 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
FROM continuumio/miniconda3:23.5.2-0 AS build
LABEL authors="[email protected]" \
description="Docker image containing base requirements for nf-LO pipelines"
# Install the package as normal:
COPY environment.yml .
# Add missing mamba dependency then clean cache
RUN apt-get update -qq && apt-get install -qq -y \
libarchive-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install mamba to speed up the process
RUN conda install -c conda-forge -y mamba
# Create the environment
RUN mamba env create -f environment.yml
# Install conda-pack:
RUN mamba install -c conda-forge conda-pack
# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda-pack -n nf-LO -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# We've put venv in same path it'll be in final image,
# so now fix up paths:
RUN /venv/bin/conda-unpack
# The runtime-stage image; we can use Debian as the
# base image since the Conda env also includes Python
# for us.
FROM debian:buster AS runtime
# Install procps in debian to make it compatible with reporting
RUN apt-get update && \
apt install -y procps gcc g++ curl make pkg-config zlib1g-dev git python2.7 file && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Define working directory
WORKDIR /app
# Add minimal dependencies
RUN apt-get update -y -qq && \
apt-get upgrade -y -qq && \
apt-get install -y -qq make pkg-config zlib1g-dev git python2.7 libxrender1 libxext6 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Link python2.7 to python
RUN ln /usr/bin/python2.7 /usr/bin/python
# Install mafTools
RUN git clone https://github.com/ComparativeGenomicsToolkit/sonLib.git && \
cd sonLib && \
make
RUN git clone https://github.com/ComparativeGenomicsToolkit/pinchesAndCacti.git && \
cd pinchesAndCacti && \
make
RUN git clone https://github.com/dentearl/mafTools.git && \
cd mafTools && \
sed -i 's/\${cxx}/\${cxx}\ \-lm/g' */Makefile && \
sed -i 's/char\ fmtName\[10\]/char\ fmtName\[30\]/g' lib/sharedMaf.c && \
sed -i 's/char\ fmtName\[10\]/char\ fmtName\[30\]/g' mafToFastaStitcher/src/mafToFastaStitcherAPI.c && \
make && \
cp ./bin/* /usr/local/bin && \
chmod a+x /usr/local/bin/*
# Clean-up post installation
RUN rm -rf /app/*
RUN apt-get remove -y -qq python2.7 make pkg-config git && \
apt-get clean -y -qq && \
apt-get autoremove -y -qq && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy /venv from the previous stage:
COPY --from=build /venv /venv
# When image is run, run the code with the environment
# activated:
ENV PATH /venv/bin/:$PATH
SHELL ["/bin/bash", "-c"]