Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions 3.12-minimal/Dockerfile.rhel10
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
FROM ubi10-minimal:latest


EXPOSE 8080

ENV PYTHON_VERSION=3.12 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
CNB_STACK_ID=com.redhat.stacks.ubi10-python-312 \
CNB_USER_ID=1001 \
CNB_GROUP_ID=0 \
PIP_NO_CACHE_DIR=off \
# The following variables are usually available from parent s2i images \
STI_SCRIPTS_PATH=/usr/libexec/s2i \
APP_ROOT=/opt/app-root \
HOME=/opt/app-root/src \
PLATFORM="el10"

# /opt/app-root/bin - the main venv
# /opt/app-root/src/bin - app-specific binaries
# /opt/app-root/src/.local/bin - tools like pipenv
ENV PATH=$APP_ROOT/bin:$HOME/bin:$HOME/.local/bin:$PATH

# RHEL7 base images automatically set these envvars to run scl_enable. RHEl8
# images, however, don't as most images don't need SCLs any more. But we want
# to run it even on RHEL8, because we set the virtualenv environment as part of
# that script
ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \
ENV=${APP_ROOT}/etc/scl_enable \
PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
building and running various Python $PYTHON_VERSION applications and frameworks. \
Python is an easy to learn, powerful programming language. It has efficient high-level \
data structures and a simple but effective approach to object-oriented programming. \
Python's elegant syntax and dynamic typing, together with its interpreted nature, \
make it an ideal language for scripting and rapid application development in many areas \
on most platforms."

LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="Python 3.12" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder,python,python312,python-312,rh-python312" \
com.redhat.component="python-312-container" \
name="ubi10/python-312-minimal" \
version="1" \
usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.12-minimal/test/setup-test-app/ ubi10/python-312-minimal python-sample-app" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
io.buildpacks.stack.id="com.redhat.stacks.ubi10-python-312-minimal" \
maintainer="SoftwareCollections.org <sclorg@redhat.com>"

# Very minimal set of packages
# Python is obvious in the Python container :)
# glibc-langpack-en is needed to set locale to en_US and disable warning about it
# findutils - find command is needed for fix-permissions script
# nss_wrapper - used in generate_container_user script
RUN INSTALL_PKGS="python3.12 glibc-langpack-en findutils nss_wrapper-libs" && \
microdnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \
microdnf -y clean all --enablerepo='*'

# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH.
COPY 3.12-minimal/s2i/bin/ $STI_SCRIPTS_PATH

# Copy extra files to the image.
COPY 3.12-minimal/root/ /

# Python 3.7+ only
# Yes, the directory below is already copied by the previous command.
# The problem here is that the wheels directory is copied as a symlink.
# Only if you specify symlink directly as a source, COPY copies all the
# files from the symlink destination.
COPY 3.12-minimal/root/opt/wheels /opt/wheels

# This command sets (and also creates if necessary)
# the home directory - it has to be done here so the latter
# fix-permissions fixes this directory as well.
WORKDIR ${HOME}

# - Create a Python virtual environment for use by any application to avoid
# potential conflicts with Python packages preinstalled in the main Python
# installation.
# - In order to drop the root user, we have to make some directories world
# writable as OpenShift default security model is to run the container
# under random UID.
RUN \
python3.12 -m venv ${APP_ROOT} && \
# We have to upgrade pip to a newer version because \
# pip < 19.3 does not support manylinux2014 wheels. Only manylinux2014 (and later) wheels \
# support platforms like ppc64le, aarch64 or armv7 \
# We are newly using wheel from one of the latest stable Fedora releases (from RPM python-pip-wheel) \
# because it's tested better then whatever version from PyPI and contains useful patches. \
# We have to do it here so the permissions are correctly fixed and pip is able \
# to reinstall itself in the next build phases in the assemble script if user wants the latest version \
${APP_ROOT}/bin/pip install /opt/wheels/pip-* && \
rm -r /opt/wheels && \
chown -R 1001:0 ${APP_ROOT} && \
fix-permissions ${APP_ROOT} -P && \
rpm-file-permissions

USER 1001

# Set the default CMD to print the usage of the language image.
CMD $STI_SCRIPTS_PATH/usage
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Python versions currently provided are:
RHEL versions currently supported are:
* RHEL 8 ([catalog.redhat.com](https://catalog.redhat.com/software/containers/search))
* RHEL 9 ([catalog.redhat.com](https://catalog.redhat.com/software/containers/search))
* RHEL 10 ([catalog.redhat.com](https://catalog.redhat.com/software/containers/search))

CentOS Stream versions currently supported are:
* CentOS Stream 9 ([quay.io/sclorg](https://quay.io/organization/sclorg))
Expand Down
3 changes: 3 additions & 0 deletions manifest-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ DISTGEN_MULTI_RULES:
- src: src/Dockerfile-minimal.template
dest: Dockerfile.rhel9

- src: src/Dockerfile-minimal.template
dest: Dockerfile.rhel10

- src: src/Dockerfile-minimal.template
dest: Dockerfile.fedora

Expand Down
21 changes: 21 additions & 0 deletions specs/multispec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ specs:
"3.11": ['python3.11', 'python3.11-devel', 'python3.11-pip']
"3.12": ['python3.12', 'python3.12-devel', 'python3.12-pip']

rhel10:
distros:
- rhel-10-x86_64
el_version: "10"
minimal_image: "ubi10-minimal:latest"
s2i_base: ubi10/s2i-base
img_tag: "1"
org: "ubi10"
prod: "rhel10"
logos: "redhat-logos-httpd"
python_pkgs: []
base_pkgs: ['nss_wrapper-libs', 'httpd', 'httpd-devel', 'mod_ssl',
'mod_auth_gssapi', 'mod_ldap', 'mod_session',
'atlas-devel', 'gcc-gfortran', 'libffi-devel', 'libtool-ltdl', 'enchant',
'krb5-devel']
ubi_versions: ['3.12']
extra_pkgs:
"3.12": ['python3.12', 'python3.12-devel', 'python3.12-pip']


c9s:
distros:
- centos-stream-9-x86_64
Expand Down Expand Up @@ -234,6 +254,7 @@ matrix:
- centos-stream-9-x86_64
- rhel-8-x86_64
- rhel-9-x86_64
- rhel-10-x86_64
version: "3.12-minimal"
- distros:
- fedora-41-x86_64
Expand Down