|
1 | 1 | ARG TARGETARCH |
2 | 2 |
|
3 | | -FROM quay.io/sclorg/python-312-c9s:c9s AS buildscripts |
| 3 | +FROM quay.io/centos/centos:stream9 AS buildscripts |
4 | 4 | COPY base-images/utils/aipcc.sh /mnt/aipcc.sh |
| 5 | +COPY base-images/utils/fix-permissions base-images/utils/rpm-file-permissions /mnt/usr/bin/ |
5 | 6 |
|
6 | 7 | #################### |
7 | 8 | # base # |
8 | 9 | #################### |
9 | | -FROM quay.io/sclorg/python-312-c9s:c9s AS base |
| 10 | +FROM quay.io/centos/centos:stream9 AS base |
| 11 | + |
| 12 | +ARG PYTHON_VERSION=3.12 |
| 13 | +ENV PYTHON=python${PYTHON_VERSION} |
| 14 | + |
| 15 | +ARG VARIANT=cpu |
| 16 | +ARG NAME=odh-base-image-cpu-py312-c9s |
| 17 | +ARG SUMMARY="Open Data Hub Notebooks Base Image for ${VARIANT} with Python ${PYTHON_VERSION}" |
| 18 | +# https://github.com/projectatomic/ContainerApplicationGenericLabels |
| 19 | +ARG DESCRIPTION="${SUMMARY} with Python ${PYTHON_VERSION}" |
| 20 | + |
| 21 | +LABEL summary="${SUMMARY}" \ |
| 22 | + description="${DESCRIPTION}" \ |
| 23 | + io.k8s.display-name="${SUMMARY}" \ |
| 24 | + io.k8s.description="${DESCRIPTION}" |
10 | 25 |
|
11 | 26 | USER 0 |
| 27 | +ARG TARGETARCH |
| 28 | +ENV TARGETARCH=${TARGETARCH} |
| 29 | + |
| 30 | +# MPI implementation (default: OpenMPI) |
| 31 | +ENV MPI_HOME=/usr/lib64/openmpi |
| 32 | + |
| 33 | +ENV APP_ROOT=/opt/app-root |
| 34 | +ENV HOME=${APP_ROOT}/src |
| 35 | +ENV PATH=${HOME}/bin:${HOME}/.local/bin:${APP_ROOT}/bin:/usr/local/sbin:/usr/local/bin:${MPI_HOME}/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| 36 | + |
| 37 | +# Python and virtual env settings |
| 38 | +ENV VIRTUAL_ENV=${APP_ROOT} \ |
| 39 | + PIP_NO_CACHE_DIR=off \ |
| 40 | + UV_NO_CACHE=true \ |
| 41 | + PIP_DISABLE_PIP_VERSION_CHECK=1 \ |
| 42 | + PYTHONUNBUFFERED=1 \ |
| 43 | + PYTHONIOENCODING=utf-8 \ |
| 44 | + LANG=en_US.UTF-8 \ |
| 45 | + LC_ALL=en_US.UTF-8 \ |
| 46 | + PS1="(app-root) \w\$ " |
| 47 | + |
| 48 | +# OpenShift s2i / Cloud Native Buildpack user |
| 49 | +ENV CNB_USER_ID=1001 \ |
| 50 | + CNB_GROUP_ID=0 |
| 51 | + |
| 52 | +# Create home directory and XDG cache directory group-writable. $HOME |
| 53 | +# is owned by 1001:0. All directories are writable by gid 0. |
| 54 | +# hadolint ignore=DL3046 |
| 55 | +RUN useradd -u ${CNB_USER_ID} -g ${CNB_GROUP_ID} -d ${HOME} -K HOME_MODE=0770 -K UMASK=0007 -m -s /bin/bash -c "Default Application User" default \ |
| 56 | + && mkdir -m 770 "${HOME}/.cache" |
| 57 | + |
| 58 | +# permission fixer from github.com/sclorg |
| 59 | +COPY --from=buildscripts /mnt/usr/bin/ /usr/bin/ |
12 | 60 |
|
13 | 61 | RUN \ |
14 | 62 | --mount=from=buildscripts,source=/mnt,target=/mnt \ |
15 | 63 | --mount=type=cache,sharing=locked,id=dnf-c9s,target=/var/cache/dnf \ |
16 | 64 | /bin/bash <<'EOF' |
| 65 | +set -Eeuxo pipefail |
17 | 66 | /mnt/aipcc.sh |
| 67 | +fix-permissions ${APP_ROOT} -P |
18 | 68 | EOF |
19 | 69 |
|
| 70 | +RUN rpm-file-permissions |
| 71 | + |
20 | 72 | # Restore user workspace |
21 | | -USER 1001 |
22 | | -WORKDIR /opt/app-root/src |
| 73 | +WORKDIR ${APP_ROOT} |
| 74 | +USER ${CNB_USER_ID}:${CNB_GROUP_ID} |
| 75 | + |
| 76 | +# RHELAI-2417, RHELAI-1720: workaround for PyArrow |
| 77 | +# libjemalloc.so.2: cannot allocate memory in static TLS block |
| 78 | +ENV LD_PRELOAD=/usr/lib64/libjemalloc.so.2 |
0 commit comments