-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.debian
More file actions
119 lines (109 loc) · 5.78 KB
/
Copy pathDockerfile.debian
File metadata and controls
119 lines (109 loc) · 5.78 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
106
107
108
109
110
111
112
113
114
115
116
117
118
# TODO : avoid duplication in trying to use the same docker file for debian and ubuntu
# 2 distinct files exist now because the releases for debian 12 are used for the remote drivers
# 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"
# Install dev tools and miniforge (for the unit tests); build and install Khiops
ARG KHIOPS_REVISION
RUN true \
# Install git (for khiops-python version calculation) and pip \
&& apt-get -y update \
&& apt-get -y --no-install-recommends install git python3-pip \
# On Debian/Ubuntu systems, python3-venv must be installed to provide ensurepip.
# It is still possible to create venvs using the --without-pip flag but any subsequent
# module installation with pip would be impossible
python3-venv \
zip pandoc wget ruby-dev \
# Get Linux distribution codename \
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
# Obtain the Khiops native package \
&& KHIOPS_PKG_FILE=$KHIOPS_REVISION/khiops-core-openmpi_$KHIOPS_REVISION-1-$VERSION_CODENAME.amd64.deb \
&& wget -O KHIOPS_CORE.deb "https://github.com/KhiopsML/khiops/releases/download/${KHIOPS_PKG_FILE}" \
# Install the Khiops native package : make it always succeed. \
# If dpkg fails it is due to missing dependencies which will be installed by apt in the next line \
&& (dpkg -i --force-all KHIOPS_CORE.deb || true) \
&& apt-get -f -y install \
&& rm -f KHIOPS_CORE.deb \
# Set python to python3 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
# 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 \
# Make sure that MPI is openmpi \
&& update-alternatives --set mpirun /usr/bin/mpirun.openmpi \
# Clean build files \
&& rm -fr /var/lib/apt/lists/* \
&& apt-get clean \
&& 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
ARG KHIOPS_GCS_DRIVER_REVISION
ARG KHIOPS_S3_DRIVER_REVISION
# Install Conda packages
# Use `rc` label for alpha or RC khiops-core pre-releases
RUN true \
&& export CONDA="/root/miniforge3/bin/conda" \
&& /bin/bash -c 'if [[ $(echo ${KHIOPS_REVISION} | grep -E ".*-(a|rc)\.[0-9]+") ]]; then \
export RC_LABEL="conda-forge/label/rc::"; \
else \
export RC_LABEL=""; \
fi; \
# Update conda to the latest version \
$CONDA update -n base conda; \
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; \
# khiops core \
$CONDA install -y -n py${version}_conda "${RC_LABEL}"khiops-core==$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
# remote files drivers installed in the conda environment \
$CONDA install -y -n py${version}_conda \
khiops-driver-s3==${KHIOPS_S3_DRIVER_REVISION} \
khiops-driver-gcs==${KHIOPS_GCS_DRIVER_REVISION}; \
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 ./run_fake_remote_file_servers.sh /scripts/
RUN chmod +x /scripts/run_service.sh /scripts/run_fake_remote_file_servers.sh && \
useradd -rm -d /home/ubuntu -s /bin/bash -g root -u 1000 ubuntu
# remote files drivers installed system-wide
RUN true \
# Get Linux distribution codename \
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
# Force the installation of the debian 12 versions (bookworm)
&& wget -O khiops-gcs.deb https://github.com/KhiopsML/khiopsdriver-gcs/releases/download/${KHIOPS_GCS_DRIVER_REVISION}/khiops-driver-gcs_${KHIOPS_GCS_DRIVER_REVISION}-1-bookworm.amd64.deb \
&& wget -O khiops-s3.deb https://github.com/KhiopsML/khiopsdriver-s3/releases/download/${KHIOPS_S3_DRIVER_REVISION}/khiops-driver-s3_${KHIOPS_S3_DRIVER_REVISION}-1-bookworm.amd64.deb \
&& (dpkg -i --force-all khiops-gcs.deb khiops-s3.deb || true) \
&& apt-get -f -y install \
&& rm -f khiops-gcs.deb khiops-s3.deb \
&& true
FROM ghcr.io/khiopsml/khiops-server:${SERVER_REVISION} AS server
FROM khiopsdev AS base
COPY --from=server /service /usr/bin/service
# S3 fake file server (only in the ubuntu container)
# Do not use the latest fakes3 version because starting from 1.3 a licence is required
# if fakes3 is no longer compatible think about switching to an alternative and fully compatible server
# (https://github.com/jamhall/s3rver:v3.7.1 is not yet for example)
RUN gem install fakes3:1.2.1 sorted_set
# Avoid resolving a fake s3-bucket.localhost hostname
# Alternate builders (buildx via moby buildkit) mount /etc/hosts read-only, the following command will fail
# echo "127.0.0.1 s3-bucket.localhost" >> /etc/hosts
# You will have to add the `add-hosts` input instead (https://github.com/docker/build-push-action/#inputs)
# Port on which fakes3 is listening
EXPOSE 4569