Skip to content

Commit a0c84f1

Browse files
committed
Distgen generated content
1 parent 54dfed4 commit a0c84f1

File tree

2 files changed

+194
-0
lines changed

2 files changed

+194
-0
lines changed

3.13-minimal/Dockerfile.c10s

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
FROM quay.io/centos/centos:stream10-development-minimal
2+
3+
4+
EXPOSE 8080
5+
6+
ENV PYTHON_VERSION=3.13 \
7+
PYTHONUNBUFFERED=1 \
8+
PYTHONIOENCODING=UTF-8 \
9+
LC_ALL=en_US.UTF-8 \
10+
LANG=en_US.UTF-8 \
11+
CNB_STACK_ID=com.redhat.stacks.ubi10-python-313 \
12+
CNB_USER_ID=1001 \
13+
CNB_GROUP_ID=0 \
14+
PIP_NO_CACHE_DIR=off \
15+
# The following variables are usually available from parent s2i images \
16+
STI_SCRIPTS_PATH=/usr/libexec/s2i \
17+
APP_ROOT=/opt/app-root \
18+
HOME=/opt/app-root/src \
19+
PLATFORM="el10"
20+
21+
# /opt/app-root/bin - the main venv
22+
# /opt/app-root/src/bin - app-specific binaries
23+
# /opt/app-root/src/.local/bin - tools like pipenv
24+
ENV PATH=$APP_ROOT/bin:$HOME/bin:$HOME/.local/bin:$PATH
25+
26+
# Ensure the virtual environment is active in interactive shells
27+
ENV BASH_ENV=${APP_ROOT}/bin/activate \
28+
ENV=${APP_ROOT}/bin/activate \
29+
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"
30+
31+
ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
32+
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
33+
building and running various Python $PYTHON_VERSION applications and frameworks. \
34+
Python is an easy to learn, powerful programming language. It has efficient high-level \
35+
data structures and a simple but effective approach to object-oriented programming. \
36+
Python's elegant syntax and dynamic typing, together with its interpreted nature, \
37+
make it an ideal language for scripting and rapid application development in many areas \
38+
on most platforms."
39+
40+
LABEL summary="$SUMMARY" \
41+
description="$DESCRIPTION" \
42+
io.k8s.description="$DESCRIPTION" \
43+
io.k8s.display-name="Python 3.13" \
44+
io.openshift.expose-services="8080:http" \
45+
io.openshift.tags="builder,python,python313,python-313,rh-python313" \
46+
com.redhat.component="python-313-container" \
47+
name="sclorg/python-313-minimal-c10s" \
48+
usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.13-minimal/test/setup-test-app/ ubi10/python-313-minimal python-sample-app" \
49+
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \
50+
io.buildpacks.stack.id="com.redhat.stacks.ubi10-python-313-minimal" \
51+
maintainer="SoftwareCollections.org <sclorg@redhat.com>"
52+
53+
# Very minimal set of packages
54+
# Python is obvious in the Python container :)
55+
# glibc-langpack-en is needed to set locale to en_US and disable warning about it
56+
# findutils - find command is needed for fix-permissions script
57+
# nss_wrapper - used in generate_container_user script
58+
RUN INSTALL_PKGS="python3.13 glibc-langpack-en findutils nss_wrapper-libs" && \
59+
microdnf -y install epel-release && \
60+
microdnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \
61+
microdnf -y clean all --enablerepo='*'
62+
63+
# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH.
64+
COPY 3.13-minimal/s2i/bin/ $STI_SCRIPTS_PATH
65+
66+
# Copy extra files to the image.
67+
COPY 3.13-minimal/root/ /
68+
69+
# Python 3.7+ only
70+
# Yes, the directory below is already copied by the previous command.
71+
# The problem here is that the wheels directory is copied as a symlink.
72+
# Only if you specify symlink directly as a source, COPY copies all the
73+
# files from the symlink destination.
74+
COPY 3.13-minimal/root/opt/wheels /opt/wheels
75+
76+
# This command sets (and also creates if necessary)
77+
# the home directory - it has to be done here so the latter
78+
# fix-permissions fixes this directory as well.
79+
WORKDIR ${HOME}
80+
81+
# - Create a Python virtual environment for use by any application to avoid
82+
# potential conflicts with Python packages preinstalled in the main Python
83+
# installation.
84+
# - In order to drop the root user, we have to make some directories world
85+
# writable as OpenShift default security model is to run the container
86+
# under random UID.
87+
RUN \
88+
python3.13 -m venv ${APP_ROOT} && \
89+
# We have to upgrade pip to a newer version because \
90+
# pip < 19.3 does not support manylinux2014 wheels. Only manylinux2014 (and later) wheels \
91+
# support platforms like ppc64le, aarch64 or armv7 \
92+
# We are newly using wheel from one of the latest stable Fedora releases (from RPM python-pip-wheel) \
93+
# because it's tested better then whatever version from PyPI and contains useful patches. \
94+
# We have to do it here so the permissions are correctly fixed and pip is able \
95+
# to reinstall itself in the next build phases in the assemble script if user wants the latest version \
96+
${APP_ROOT}/bin/pip install /opt/wheels/pip-* && \
97+
rm -r /opt/wheels && \
98+
chown -R 1001:0 ${APP_ROOT} && \
99+
fix-permissions ${APP_ROOT} -P && \
100+
rpm-file-permissions
101+
102+
USER 1001
103+
104+
# Set the default CMD to print the usage of the language image.
105+
CMD $STI_SCRIPTS_PATH/usage

3.13/Dockerfile.c10s

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This image provides a Python 3.13 environment you can use to run your Python
2+
# applications.
3+
FROM quay.io/sclorg/s2i-base-c10s:c10s
4+
5+
EXPOSE 8080
6+
7+
ENV PYTHON_VERSION=3.13 \
8+
PATH=$HOME/.local/bin/:$PATH \
9+
PYTHONUNBUFFERED=1 \
10+
PYTHONIOENCODING=UTF-8 \
11+
LC_ALL=en_US.UTF-8 \
12+
LANG=en_US.UTF-8 \
13+
PIP_NO_CACHE_DIR=off
14+
15+
ENV NAME=python3 \
16+
ARCH=x86_64
17+
18+
ENV SUMMARY="Platform for building and running Python $PYTHON_VERSION applications" \
19+
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
20+
building and running various Python $PYTHON_VERSION applications and frameworks. \
21+
Python is an easy to learn, powerful programming language. It has efficient high-level \
22+
data structures and a simple but effective approach to object-oriented programming. \
23+
Python's elegant syntax and dynamic typing, together with its interpreted nature, \
24+
make it an ideal language for scripting and rapid application development in many areas \
25+
on most platforms."
26+
27+
LABEL summary="$SUMMARY" \
28+
description="$DESCRIPTION" \
29+
io.k8s.description="$DESCRIPTION" \
30+
io.k8s.display-name="Python 3.13" \
31+
io.openshift.expose-services="8080:http" \
32+
io.openshift.tags="builder,python,python313,python-313,rh-python313" \
33+
com.redhat.component="$NAME" \
34+
name="sclorg/python-313-c10s" \
35+
usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.13/test/setup-test-app/ $FGC/$NAME python-sample-app" \
36+
maintainer="SoftwareCollections.org <sclorg@redhat.com>"
37+
38+
RUN INSTALL_PKGS="python3.13 python3.13-devel python3.13-pip nss_wrapper-libs httpd \
39+
httpd-devel mod_ssl mod_auth_gssapi mod_ldap mod_session \
40+
gcc-gfortran libffi-devel libtool-ltdl krb5-devel" && \
41+
yum -y install epel-release && \
42+
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
43+
rpm -V $INSTALL_PKGS && \
44+
yum -y clean all --enablerepo='*'
45+
46+
# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH.
47+
COPY 3.13/s2i/bin/ $STI_SCRIPTS_PATH
48+
49+
# Copy extra files to the image.
50+
COPY 3.13/root/ /
51+
52+
# Python 3.7+ only
53+
# Yes, the directory below is already copied by the previous command.
54+
# The problem here is that the wheels directory is copied as a symlink.
55+
# Only if you specify symlink directly as a source, COPY copies all the
56+
# files from the symlink destination.
57+
COPY 3.13/root/opt/wheels /opt/wheels
58+
# - Create a Python virtual environment for use by any application to avoid
59+
# potential conflicts with Python packages preinstalled in the main Python
60+
# installation.
61+
# - In order to drop the root user, we have to make some directories world
62+
# writable as OpenShift default security model is to run the container
63+
# under random UID.
64+
RUN python3.13 -m venv ${APP_ROOT} && \
65+
# Python 3.7+ only code, Python <3.7 installs pip from PyPI in the assemble script. \
66+
# We have to upgrade pip to a newer verison because \
67+
# pip < 19.3 does not support manylinux2014 wheels. Only manylinux2014 (and later) wheels \
68+
# support platforms like ppc64le, aarch64 or armv7 \
69+
# We are newly using wheel from one of the latest stable Fedora releases (from RPM python-pip-wheel) \
70+
# because it's tested better then whatever version from PyPI and contains useful patches. \
71+
# We have to do it here (in the macro) so the permissions are correctly fixed and pip is able \
72+
# to reinstall itself in the next build phases in the assemble script if user wants the latest version \
73+
${APP_ROOT}/bin/pip install /opt/wheels/pip-* && \
74+
rm -r /opt/wheels && \
75+
chown -R 1001:0 ${APP_ROOT} && \
76+
fix-permissions ${APP_ROOT} -P && \
77+
# The following echo adds the unset command for the variables set below to the \
78+
# venv activation script. This prevents the virtual environment from being \
79+
# activated multiple times and also every time the prompt is rendered. \
80+
echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate
81+
# Ensure the virtualenv is activated in interactive shells
82+
ENV BASH_ENV="${APP_ROOT}/bin/activate" \
83+
ENV="${APP_ROOT}/bin/activate" \
84+
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"
85+
86+
USER 1001
87+
88+
# Set the default CMD to print the usage of the language image.
89+
CMD $STI_SCRIPTS_PATH/usage

0 commit comments

Comments
 (0)