diff --git a/base/c9s-python-3.11/Dockerfile b/base/c9s-python-3.11/Dockerfile index f0f0d570c..c71c79d47 100644 --- a/base/c9s-python-3.11/Dockerfile +++ b/base/c9s-python-3.11/Dockerfile @@ -1,4 +1,21 @@ -FROM quay.io/sclorg/python-311-c9s:c9s +FROM quay.io/centos/centos:stream9 + +# perform the setup that python image used to do for us +# but this way it uses a lot less disk space (hundreds of megabytes less) +ENV APP_ROOT="/opt/app-root" +ENV HOME="${APP_ROOT}/src" +ENV VIRTUAL_ENV="${APP_ROOT}" +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" +ENV PYTHON_VERSION=3.11 +ENV PIP_NO_CACHE_DIR=off +RUN mkdir --parents "${HOME}" && chmod --recursive 0771 ${APP_ROOT} && chown --recursive 1001:0 ${APP_ROOT} && \ + useradd --uid 1001 --gid 0 --no-create-home --home-dir "${HOME}" \ + --comment "Default Application User" --shell /bin/bash default && \ + dnf install -y python311-pip && dnf clean all && rm -rf /var/cache/yum/* +COPY --from=quay.io/sclorg/s2i-core-c9s:latest /usr/bin/fix-permissions /usr/bin/rpm-file-permissions /usr/bin/ + +USER 1001 +RUN python${PYTHON_VERSION} -m venv "${VIRTUAL_ENV}" LABEL name="odh-notebook-base-centos-stream9-python-3.11" \ summary="Python 3.11 CentOS Stream 9 base image for ODH notebooks" \ diff --git a/base/c9s-python-3.9/Dockerfile b/base/c9s-python-3.9/Dockerfile index f3ed220aa..7128e8f59 100644 --- a/base/c9s-python-3.9/Dockerfile +++ b/base/c9s-python-3.9/Dockerfile @@ -55,7 +55,7 @@ RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./P tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \ rm -f /tmp/openshift-client-linux.tar.gz && \ # Fix permissions to support pip in Openshift environments \ - chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \ + chmod -R g+w /opt/app-root/lib/python${PYTHON_VERSION}/site-packages && \ fix-permissions /opt/app-root -P WORKDIR /opt/app-root/src diff --git a/base/ubi9-python-3.9/Dockerfile b/base/ubi9-python-3.9/Dockerfile index 938fd8c5b..a1dcdc757 100644 --- a/base/ubi9-python-3.9/Dockerfile +++ b/base/ubi9-python-3.9/Dockerfile @@ -35,7 +35,7 @@ RUN pip install --no-cache-dir -U "micropipenv[toml]" # Install Python dependencies from Pipfile.lock file COPY Pipfile.lock ./ -RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock +RUN echo "Installing software and packages" && micropipenv install && rm -f ./Pipfile.lock # OS Packages needs to be installed as root USER root @@ -57,7 +57,7 @@ RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/oc rm -f /tmp/openshift-client-linux.tar.gz # Fix permissions to support pip in Openshift environments -RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \ +RUN chmod -R g+w /opt/app-root/lib/python${PYTHON_VERSION}/site-packages && \ fix-permissions /opt/app-root -P WORKDIR /opt/app-root/src