|
a |
|
b/Dockerfile |
|
|
1 |
# This Dockerfile supports amd64,arm64,ppc64le |
|
|
2 |
# Note: QEMU emulated ppc64le build might take ~6 hours |
|
|
3 |
|
|
|
4 |
# Use conda to resolve dependencies cross-platform |
|
|
5 |
FROM debian:bookworm as builder |
|
|
6 |
|
|
|
7 |
# install libpng to system for cross-architecture support |
|
|
8 |
# https://github.com/ANTsX/ANTs/issues/1069#issuecomment-681131938 |
|
|
9 |
RUN apt-get update && \ |
|
|
10 |
apt-get install -y --no-install-recommends \ |
|
|
11 |
apt-transport-https \ |
|
|
12 |
bash \ |
|
|
13 |
build-essential \ |
|
|
14 |
ca-certificates \ |
|
|
15 |
git \ |
|
|
16 |
libpng-dev \ |
|
|
17 |
wget |
|
|
18 |
|
|
|
19 |
# install miniconda3 |
|
|
20 |
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh \ |
|
|
21 |
&& /bin/bash Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh -b -p /opt/conda \ |
|
|
22 |
&& rm Miniconda3-py310_23.11.0-1-Linux-$(uname -m).sh |
|
|
23 |
ENV PATH=/opt/conda/bin:$PATH |
|
|
24 |
|
|
|
25 |
WORKDIR /usr/local/src |
|
|
26 |
|
|
|
27 |
COPY environment.yml . |
|
|
28 |
|
|
|
29 |
# Activate the base environment and update it |
|
|
30 |
RUN . /opt/conda/etc/profile.d/conda.sh && \ |
|
|
31 |
conda activate base && \ |
|
|
32 |
conda info && \ |
|
|
33 |
conda config --show-sources && \ |
|
|
34 |
echo "Updating conda" && \ |
|
|
35 |
conda env update -n base && \ |
|
|
36 |
echo "installing cmake" && \ |
|
|
37 |
conda install -c conda-forge cmake |
|
|
38 |
|
|
|
39 |
COPY . . |
|
|
40 |
|
|
|
41 |
# number of parallel make jobs |
|
|
42 |
ARG j=2 |
|
|
43 |
RUN . /opt/conda/etc/profile.d/conda.sh && \ |
|
|
44 |
pip --no-cache-dir -v install . |
|
|
45 |
|
|
|
46 |
# run tests |
|
|
47 |
RUN bash tests/run_tests.sh |
|
|
48 |
|
|
|
49 |
# optimize layers |
|
|
50 |
FROM debian:bookworm-slim |
|
|
51 |
COPY --from=builder /opt/conda /opt/conda |
|
|
52 |
ENV PATH=/opt/conda/bin:$PATH |