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
11 changes: 4 additions & 7 deletions 3.11-minimal/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.11 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
11 changes: 4 additions & 7 deletions 3.11-minimal/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.11 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
9 changes: 0 additions & 9 deletions 3.11-minimal/root/opt/app-root/etc/scl_enable

This file was deleted.

4 changes: 2 additions & 2 deletions 3.11-minimal/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ if is_gunicorn_installed; then
gunicorn_settings_source="custom"
fi

# Gunicorn can read GUNICORN_CMD_ARGS as an env variable but because this is not
# supported in Gunicorn < 20 we still need for Python 2, we are using arguments directly.
# Gunicorn can read GUNICORN_CMD_ARGS as an env variable; we also pass them as
# arguments explicitly for compatibility with older Gunicorn versions.
echo "---> Serving application with gunicorn ($APP_MODULE) with $gunicorn_settings_source settings ..."
exec gunicorn "$APP_MODULE" $GUNICORN_CMD_ARGS --config "$APP_CONFIG"
fi
Expand Down
20 changes: 2 additions & 18 deletions 3.11-minimal/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ test_application_enable_init_wrapper
"

TEST_VAR_DOCKER="\
test_scl_variables_in_dockerfile
test_from_dockerfile_minimal
"

Expand All @@ -48,7 +47,7 @@ if [[ -z $VERSION ]]; then
exit 1
fi

IMAGE_NAME=${IMAGE_NAME:-centos/python-${VERSION//./}-centos7}
IMAGE_NAME=${IMAGE_NAME:-ubi9/python-${VERSION//./}}

. test/test-lib.sh

Expand Down Expand Up @@ -128,7 +127,7 @@ test_scl_usage() {
local expected="$2"
local cid_file="$3"

info "Testing the image SCL enable"
info "Testing command availability in the image"
out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}" 2>&1)
if ! echo "${out}" | grep -q "${expected}"; then
echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'"
Expand Down Expand Up @@ -240,21 +239,6 @@ test_application_enable_init_wrapper() {
CONTAINER_ARGS="-e ENABLE_INIT_WRAPPER=true" test_application
}

test_scl_variables_in_dockerfile() {
if [ "$OS" == "rhel7" ] || [ "$OS" == "centos7" ]; then
TESTCASE_RESULT=0
CID_FILE_DIR=$(mktemp -d)

info "Testing variable presence during \`docker exec\`"
ct_check_exec_env_vars
ct_check_testcase_result $?

info "Checking if all scl variables are defined in Dockerfile"
ct_check_scl_enable_vars
ct_check_testcase_result $?
fi
}

# Positive test & non-zero exit status = ERROR.
# Negative test & zero exit status = ERROR.
# Tests with '-should-fail-' in their name should fail during a build,
Expand Down
9 changes: 3 additions & 6 deletions 3.11/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ rm -r /opt/wheels && \
chown -R 1001:0 ${APP_ROOT} && \
fix-permissions ${APP_ROOT} -P && \
# The following echo adds the unset command for the variables set below to the \
# venv activation script. This is inspired from scl_enable script and prevents \
# the virtual environment to be activated multiple times and also every time \
# the prompt is rendered. \
# venv activation script. This prevents the virtual environment from being \
# activated multiple times and also every time the prompt is rendered. \
echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate

# For Fedora scl_enable isn't sourced automatically in s2i-core
# so virtualenv needs to be activated this way
# Ensure the virtualenv is activated in interactive shells
ENV BASH_ENV="${APP_ROOT}/bin/activate" \
ENV="${APP_ROOT}/bin/activate" \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"
Expand Down
9 changes: 3 additions & 6 deletions 3.11/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,10 @@ RUN \
fix-permissions ${APP_ROOT} -P && \
rpm-file-permissions && \
# The following echo adds the unset command for the variables set below to the \
# venv activation script. This is inspired from scl_enable script and prevents \
# the virtual environment to be activated multiple times and also every time \
# the prompt is rendered. \
# venv activation script. This prevents the virtual environment from being \
# activated multiple times and also every time the prompt is rendered. \
echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate

# For RHEL/Centos 8+ scl_enable isn't sourced automatically in s2i-core
# so virtualenv needs to be activated this way
# Ensure the virtualenv is activated in interactive shells
ENV BASH_ENV="${APP_ROOT}/bin/activate" \
ENV="${APP_ROOT}/bin/activate" \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"
Expand Down
9 changes: 3 additions & 6 deletions 3.11/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ RUN \
fix-permissions ${APP_ROOT} -P && \
rpm-file-permissions && \
# The following echo adds the unset command for the variables set below to the \
# venv activation script. This is inspired from scl_enable script and prevents \
# the virtual environment to be activated multiple times and also every time \
# the prompt is rendered. \
# venv activation script. This prevents the virtual environment from being \
# activated multiple times and also every time the prompt is rendered. \
echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate

# For RHEL/Centos 8+ scl_enable isn't sourced automatically in s2i-core
# so virtualenv needs to be activated this way
# Ensure the virtualenv is activated in interactive shells
ENV BASH_ENV="${APP_ROOT}/bin/activate" \
ENV="${APP_ROOT}/bin/activate" \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"
Expand Down
10 changes: 5 additions & 5 deletions 3.11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Python 3.11 container image
=========================

This container image includes Python 3.11 as a [S2I](https://github.com/openshift/source-to-image) base image for your Python 3.11 applications.
Users can choose between RHEL and CentOS based builder images.
Users can choose between RHEL, CentOS Stream, and Fedora based builder images.
The RHEL images are available in the [Red Hat Container Catalog](https://catalog.redhat.com/software/containers/explore),
the CentOS images are available on [Quay.io](https://quay.io/organization/centos7),
and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora).
CentOS Stream images are available on [Quay.io](https://quay.io/organization/sclorg),
and the Fedora images are available on [Quay.io](https://quay.io/organization/fedora).
The resulting image can be run using [podman](https://github.com/containers/libpod) or
[docker](http://docker.io).

Expand All @@ -32,12 +32,12 @@ the nodejs itself is included just to make the npm work.
Usage in Openshift
------------------

For this, we will assume that you are using one of the supported images available via imagestream tags in Openshift, eg. `python:3.11-ubi8`
For this, we will assume that you are using one of the supported images available via imagestream tags in Openshift, eg. `python:3.11-ubi9`
Building a simple [python-sample-app](https://github.com/sclorg/django-ex.git) application
in Openshift can be achieved with the following step:

```
oc new-app python:3.11-ubi8~https://github.com/sclorg/django-ex.git
oc new-app python:3.11-ubi9~https://github.com/sclorg/django-ex.git
```

**Accessing the application:**
Expand Down
9 changes: 0 additions & 9 deletions 3.11/root/opt/app-root/etc/scl_enable

This file was deleted.

4 changes: 2 additions & 2 deletions 3.11/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ if is_gunicorn_installed; then
gunicorn_settings_source="custom"
fi

# Gunicorn can read GUNICORN_CMD_ARGS as an env variable but because this is not
# supported in Gunicorn < 20 we still need for Python 2, we are using arguments directly.
# Gunicorn can read GUNICORN_CMD_ARGS as an env variable; we also pass them as
# arguments explicitly for compatibility with older Gunicorn versions.
echo "---> Serving application with gunicorn ($APP_MODULE) with $gunicorn_settings_source settings ..."
exec gunicorn "$APP_MODULE" $GUNICORN_CMD_ARGS --config "$APP_CONFIG"
fi
Expand Down
20 changes: 2 additions & 18 deletions 3.11/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ test_application_enable_init_wrapper
"

TEST_VAR_DOCKER="\
test_scl_variables_in_dockerfile
test_from_dockerfile
"

Expand All @@ -48,7 +47,7 @@ if [[ -z $VERSION ]]; then
exit 1
fi

IMAGE_NAME=${IMAGE_NAME:-centos/python-${VERSION//./}-centos7}
IMAGE_NAME=${IMAGE_NAME:-ubi9/python-${VERSION//./}}

. test/test-lib.sh

Expand Down Expand Up @@ -128,7 +127,7 @@ test_scl_usage() {
local expected="$2"
local cid_file="$3"

info "Testing the image SCL enable"
info "Testing command availability in the image"
out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}" 2>&1)
if ! echo "${out}" | grep -q "${expected}"; then
echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'"
Expand Down Expand Up @@ -244,21 +243,6 @@ test_application_enable_init_wrapper() {
CONTAINER_ARGS="-e ENABLE_INIT_WRAPPER=true" test_application
}

test_scl_variables_in_dockerfile() {
if [ "$OS" == "rhel7" ] || [ "$OS" == "centos7" ]; then
TESTCASE_RESULT=0
CID_FILE_DIR=$(mktemp -d)

info "Testing variable presence during \`docker exec\`"
ct_check_exec_env_vars
ct_check_testcase_result $?

info "Checking if all scl variables are defined in Dockerfile"
ct_check_scl_enable_vars
ct_check_testcase_result $?
fi
}

# Positive test & non-zero exit status = ERROR.
# Negative test & zero exit status = ERROR.
# Tests with '-should-fail-' in their name should fail during a build,
Expand Down
11 changes: 4 additions & 7 deletions 3.12-minimal/Dockerfile.c10s
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.12 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
11 changes: 4 additions & 7 deletions 3.12-minimal/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.12 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
11 changes: 4 additions & 7 deletions 3.12-minimal/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.12 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
11 changes: 4 additions & 7 deletions 3.12-minimal/Dockerfile.rhel10
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.12 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
11 changes: 4 additions & 7 deletions 3.12-minimal/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ ENV PYTHON_VERSION=3.12 \
# /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"
# Ensure the virtual environment is active in interactive shells
ENV BASH_ENV=${APP_ROOT}/bin/activate \
ENV=${APP_ROOT}/bin/activate \
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

ENV SUMMARY="Minimal platform for building and running Python $PYTHON_VERSION applications" \
DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
Expand Down
9 changes: 0 additions & 9 deletions 3.12-minimal/root/opt/app-root/etc/scl_enable

This file was deleted.

4 changes: 2 additions & 2 deletions 3.12-minimal/s2i/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ if is_gunicorn_installed; then
gunicorn_settings_source="custom"
fi

# Gunicorn can read GUNICORN_CMD_ARGS as an env variable but because this is not
# supported in Gunicorn < 20 we still need for Python 2, we are using arguments directly.
# Gunicorn can read GUNICORN_CMD_ARGS as an env variable; we also pass them as
# arguments explicitly for compatibility with older Gunicorn versions.
echo "---> Serving application with gunicorn ($APP_MODULE) with $gunicorn_settings_source settings ..."
exec gunicorn "$APP_MODULE" $GUNICORN_CMD_ARGS --config "$APP_CONFIG"
fi
Expand Down
Loading