-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContainerfile
More file actions
89 lines (71 loc) · 3.08 KB
/
Containerfile
File metadata and controls
89 lines (71 loc) · 3.08 KB
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
# Use Ubuntu 20.04 LTS as the base image
FROM ubuntu:20.04
# Set working directory
WORKDIR /scratch
# Set the maintainer label
LABEL maintainer="[email protected]"
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
ENV HOME=/opt
ENV ~=/opt
# run a few apt installs
RUN apt-get update && \
apt-get install -y curl wget git gcc g++ cmake util-linux && \
rm -rf /var/lib/apt/lists/* && \
mkdir /dependencies && \
dpkg -l > /dependencies/apt-get.lock
# Install all the dependencies locked with pyproject.toml:
# ----------------------------------------------------------------------------------- #
# 1) copy the required dependency and configuration files into the image
COPY pyproject.toml $HOME/pyproject.toml
COPY pixi.lock $HOME/pixi.lock
COPY uv.lock $HOME/uv.lock
COPY lib/ $HOME/lib/
COPY main.nf $HOME/main.nf
COPY nextflow.config $HOME/nextflow.config
# 2) install pixi
RUN cd $HOME && PIXI_ARCH=x86_64 curl -fsSL https://pixi.sh/install.sh | bash
# 3) make sure pixi and pixi installs are on the $PATH
ENV PATH=$PATH:$HOME/.pixi/bin
# 4) install everything else with pixi
RUN cd $HOME && \
script -q -c "pixi install --frozen" && \
script -q -c "pixi clean cache --assume-yes" && \
script -q -c "pixi add cxx-compiler cmake make"
# 5) Add pixi environment to PATH (works in Docker, Podman, AND Apptainer)
ENV PATH=$PATH:/opt/.pixi/envs/default/bin
# 6) Set Nextflow environment variables (works in all container runtimes)
ENV NXF_CACHE_DIR=/scratch
ENV NXF_HOME=/scratch
# ----------------------------------------------------------------------------------- #
# Copy necessary ncbi files
COPY conf/user-settings.mkfg /.ncbi/user-settings.mkfg
# Install NCBI tools and configure environment
RUN mkdir -p /.ncbi && \
chmod 777 /.ncbi/user-settings.mkfg && \
mkdir /build && cd /build && \
git config --global http.sslVerify false && \
git clone -b 3.2.0 https://github.com/ncbi/ngs-tools.git && \
git clone -b 3.2.1 https://github.com/ncbi/ncbi-vdb.git && \
git clone -b 3.2.1 https://github.com/ncbi/sra-tools.git && \
sed -i 's/cmake_minimum_required[[:space:]]*([[:space:]]*VERSION[[:space:]]*2\.8\.12[[:space:]]*)/cmake_minimum_required(VERSION 3.5)/' /build/ngs-tools/CMakeLists.txt && \
echo "Verifying CMake version change:" && \
grep "cmake_minimum_required" /build/ngs-tools/CMakeLists.txt
# Build ncbi-vdb, sra-tools and ngs-tools
RUN cd /build/ncbi-vdb && \
./configure --relative-build-out-dir && \
make -j$(nproc) && \
cd /build/sra-tools && \
./configure --relative-build-out-dir && \
make -j$(nproc) && \
cd /build/ngs-tools && \
./configure --relative-build-out-dir && \
make -j$(nproc) && \
# Copy built binaries and clean up in the same layer
find /build/OUTDIR -type f -executable -exec cp {} /usr/local/bin/ \; && \
cd / && rm -rf /build
# remove now unnecessary compilers and clean the PyPI and conda caches
RUN cd $HOME && pixi remove rust cxx-compiler cmake make && pixi clean cache --yes
# Fix snakemake permission issue
RUN mkdir /.cache; chmod a+rwX /.cache