-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.rocky
More file actions
105 lines (100 loc) · 4.21 KB
/
Copy pathDockerfile.rocky
File metadata and controls
105 lines (100 loc) · 4.21 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Arguments
ARG KHIOPSDEV_OS
ARG SERVER_REVISION
FROM ghcr.io/khiopsml/khiops/khiopsdev-${KHIOPSDEV_OS}:latest AS khiopsdev
LABEL maintainer="khiops.team@orange.com"
LABEL description="Container for the development of khiops-python"
# Reuse KHIOPSDEV_OS from previous stage
ARG KHIOPSDEV_OS
ARG KHIOPS_REVISION
# - Install dev tools and miniforge (for the unit tests)
# - Build and install Khiops
# - Set mpich as the default MPI
RUN true \
&& useradd -rm -d /home/rocky -s /bin/bash -g root -u 1000 rocky \
# Install git (for khiops-python version calculation), pandoc and pip \
# --allowerasing is needed to resolve package conflicts \
&& dnf upgrade -y --allowerasing \
&& dnf search pandoc \
&& dnf install --enablerepo=devel -y \
git \
pandoc \
wget \
# Install Python 3.11 if on Rocky 8 \
&& if [ "$KHIOPSDEV_OS" = "rocky8" ]; then \
dnf install -y \
python3.11 \
python3.11-pip \
python3.11-setuptools ; \
else \
dnf install -y \
python3-setuptools \
python3-pip ; \
fi \
# Get Linux distribution codename \
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
&& IFS='.' read -ra VERSION <<< "$VERSION_ID" \
&& ROCKY_VERSION=${VERSION[0]} \
# Obtain the Khiops native package \
&& KHIOPS_PKG_FILE=$KHIOPS_REVISION/khiops-core-openmpi-$(echo ${KHIOPS_REVISION} | tr '-' '_')-1.el$ROCKY_VERSION.x86_64.rpm \
&& wget -O KHIOPS_CORE.rpm "https://github.com/KhiopsML/khiops/releases/download/${KHIOPS_PKG_FILE}" \
# Install the Khiops native package \
&& dnf install KHIOPS_CORE.rpm -y \
&& rm -f KHIOPS_CORE.rpm \
# Make sure that MPI is openmpi \
&& source /etc/profile.d/modules.sh \
&& module unload mpi \
# Hard-code OpenMPI module name \
&& module load mpi/openmpi-x86_64 \
# Set python to python3.11 and pip to Pip 3.11 on Rocky 8 \
# Set python to python3 on Rocky 9 \
&& if [ "$KHIOPSDEV_OS" = "rocky8" ]; then \
alternatives --set python /usr/bin/python3.11 \
&& alternatives --install /usr/bin/pip pip /usr/bin/pip3.11 1 ; \
else \
alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 ; \
fi \
# Install miniforge to have multiple Python versions via Conda \
&& mkdir -p /root/miniforge3 && cd /root/miniforge3 \
&& wget https://github.com/conda-forge/miniforge/releases/download/25.9.1-0/Miniforge3-25.9.1-0-Linux-x86_64.sh -O ./Miniforge3_25.9.1-0-Linux-x86_64.sh \
&& echo "07f64c1d908ae036e9f6a81f97704899311c0ae677d83980d664b9781d4cc5fc Miniforge3_25.9.1-0-Linux-x86_64.sh" | sha256sum --check \
&& bash ./Miniforge3_25.9.1-0-Linux-x86_64.sh -b -u -p /root/miniforge3 \
&& rm -rf /root/miniforge3/Miniforge3_25.9.1-0-Linux-x86_64.sh \
# Clean build files \
&& dnf clean all \
&& rm -rf ./khiops \
&& true
# set up all the supported Python environments under conda (for the unit tests)
# relying on a variable containing all the versions
ARG PYTHON_VERSIONS
# Install Conda packages
# Use `rc` label for alpha or RC khiops-core pre-releases
RUN true \
&& export CONDA="/root/miniforge3/bin/conda" \
&& if [[ $(echo ${KHIOPS_REVISION} | grep -E ".*-(a|rc)\.[0-9]+") ]]; then \
export RC_LABEL="conda-forge/label/rc::"; \
else \
export RC_LABEL=""; \
fi \
&& /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
do \
CONDA_ENVS="py${version} py${version}_conda"; \
for CONDA_ENV in $CONDA_ENVS; \
do \
$CONDA create -y -n $CONDA_ENV python=${version}; \
done; \
$CONDA install -y -n py${version}_conda ${RC_LABEL}khiops-core==$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
done; \
# Install Khiops from a different major version in a dedicated conda environment \
# The python interpreter version of the base environment is used as no specific version is given \
$CONDA create -y -n py3_khiops10_conda; \
$CONDA install -y -n py3_khiops10_conda khiops::khiops-core==10.3.1; \
' \
&& true
RUN mkdir -p /scripts
COPY ./run_service.sh /scripts/run_service.sh
RUN chmod +x /scripts/run_service.sh
FROM ghcr.io/khiopsml/khiops-server:${SERVER_REVISION} AS server
FROM khiopsdev AS base
COPY --from=server /service /usr/bin/service