Skip to content

Commit

Permalink
adding required files for f35-py310 S2I image to built
Browse files Browse the repository at this point in the history
including linting of s2i_assemble.patches for all ubi overlays so pre-commit can pass
  • Loading branch information
Gregory-Pereira committed Mar 8, 2022
1 parent 8946641 commit 2f737fe
Show file tree
Hide file tree
Showing 8 changed files with 950 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ s2i-thoth

.. |s2i-thoth-f34-py39 on Quay| image:: https://quay.io/repository/thoth-station/s2i-thoth-f34-py39/status

.. |s2i-thoth-f34-py39 on Quay| image:: https://quay.io/repository/thoth-station/s2i-thoth-f35-py310/status

Experimental Thoth container images:

* `quay.io/thoth-station/s2i-thoth-ubi8-py39 <https://quay.io/repository/thoth-station/s2i-thoth-ubi8-py39>`_ |s2i-thoth-ubi8-py39 on Quay|
Expand All @@ -19,6 +21,8 @@ Experimental Thoth container images:

* `quay.io/thoth-station/s2i-thoth-f34-py39 <https://quay.io/repository/thoth-station/s2i-thoth-f34-py39>`_ |s2i-thoth-f34-py39 on Quay|

* `quay.io/thoth-station/s2i-thoth-f35-py310 <https://quay.io/repository/thoth-station/s2i-thoth-f35-py310>`_ |s2i-thoth-f35-py310 on Quay|

Artifacts needed to build `s2i-thoth-*` container images.

These container images are complaint with OpenShift's s2i build process to
Expand Down
46 changes: 46 additions & 0 deletions f35-py310/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Thoth's extension to OpenShift's S2I build
FROM registry.fedoraproject.org/f35/python3:0-41.container

ENV SUMMARY="Thoth's Source-to-Image for Python ${PYTHON_VERSION} applications" \
DESCRIPTION="Thoth's Source-to-Image for Python ${PYTHON_VERSION} applications. This toolchain is based on Fedora 35. It includes Pipenv." \
THOTH_S2I_NAME=quay.io/thoth-station/s2i-thoth-f35-py310 \
THOTH_S2I_VERSION=0.32.3 \
THAMOS_NO_PROGRESSBAR=1 \
THAMOS_NO_EMOJI=1 \
MICROPIPENV_NO_LOCKFILE_PRINT=0 \
MICROPIPENV_NO_LOCKFILE_WRITE=0

LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="Thoth Python 3.10-f35 S2I" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="python,python310" \
name="$THOTH_S2I_NAME:v$THOTH_S2I_VERSION" \
vendor="AICoE at the Office of the CTO, Red Hat Inc." \
authoritative-source-url="https://quay.io/thoth-station/s2i-thoth" \
version="$THOTH_S2I_VERSION" \
release="0" \
ninja.thoth-station.version="0.7.0-dev" \
maintainer="Thoth Station <[email protected]>"

USER 0
COPY ./s2i_assemble.patch /tmp/s2i_assemble.patch
COPY ./requirements.txt $HOME/requirements.txt
RUN TMPFILE=$(mktemp) && \
TMPFILE_ASSEMBLE=$(mktemp) && \
pushd "${STI_SCRIPTS_PATH}" && patch -p 1 </tmp/s2i_assemble.patch && popd && \
pip3 --no-cache-dir --disable-pip-version-check install -U "pip==20.3.3" && \
/usr/bin/pip3 --no-cache-dir --disable-pip-version-check install -U "pip==20.3.3" && \
curl https://raw.githubusercontent.com/thoth-station/micropipenv/master/micropipenv.py | MICROPIPENV_NO_LOCKFILE_WRITE=1 MICROPIPENV_PIP_BIN=/usr/bin/pip3 /usr/bin/python3 - install -- && \
curl "https://raw.githubusercontent.com/thoth-station/s2i-thoth/master/assemble" -o "${TMPFILE_ASSEMBLE}" && \
cp "${STI_SCRIPTS_PATH}/assemble" "${TMPFILE}" && \
head -n1 "${TMPFILE}" >"${STI_SCRIPTS_PATH}/assemble" && \
cat "${TMPFILE_ASSEMBLE}" >>"${STI_SCRIPTS_PATH}/assemble" && \
tail -n+2 "${TMPFILE}" >>"${STI_SCRIPTS_PATH}/assemble" && \
rm "${TMPFILE}" "${TMPFILE_ASSEMBLE}" /tmp/s2i_assemble.patch requirements.txt && \
sed -i '/ echo "---> Running application from .*/d' "${STI_SCRIPTS_PATH}/run" && \
chown -R 1001:0 ${APP_ROOT} && \
fix-permissions ${APP_ROOT} -P

USER 1001
2 changes: 2 additions & 0 deletions f35-py310/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
thamos
micropipenv[toml]
796 changes: 796 additions & 0 deletions f35-py310/requirements.txt

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions f35-py310/s2i_assemble.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
--- a/assemble 2021-09-12 14:46:51.130401513 -0400
+++ b/assemble 2021-09-12 14:49:27.881361622 -0400
@@ -14,38 +14,8 @@
python3.10 -m venv $1
}

-# Install pipenv or micropipenv to the separate virtualenv to isolate it
-# from system Python packages and packages in the main
-# virtualenv. Executable is simlinked into ~/.local/bin
-# to be accessible. This approach is inspired by pipsi
-# (pip script installer).
-function install_tool() {
- echo "---> Installing $1 packaging tool ..."
- VENV_DIR=$HOME/.local/venvs/$1
- virtualenv_bin "$VENV_DIR"
- # First, try to install the tool without --isolated which means that if you
- # have your own PyPI mirror, it will take it from there. If this try fails, try it
- # again with --isolated which ignores external pip settings (env vars, config file)
- # and installs the tool from PyPI (needs internet connetion).
- # $1$2 combines package name with [extras] or version specifier if is defined as $2```
- if ! $VENV_DIR/bin/pip install -U $1$2; then
- echo "WARNING: Installation of $1 failed, trying again from official PyPI with pip --isolated install"
- $VENV_DIR/bin/pip install --isolated -U $1$2 # Combines package name with [extras] or version specifier if is defined as $2```
- fi
- mkdir -p $HOME/.local/bin
- ln -s $VENV_DIR/bin/$1 $HOME/.local/bin/$1
-}
-
set -e

-# First of all, check that we don't have disallowed combination of ENVs
-if [[ ! -z "$ENABLE_PIPENV" && ! -z "$ENABLE_MICROPIPENV" ]]; then
- echo "ERROR: Pipenv and micropipenv cannot be enabled at the same time!"
- # podman/buildah does not relay this exit code but it will be fixed hopefuly
- # https://github.com/containers/buildah/issues/2305
- exit 3
-fi
-
shopt -s dotglob
echo "---> Installing application source ..."
mv /tmp/src/* "$HOME"
@@ -53,50 +23,19 @@
# set permissions for any installed artifacts
fix-permissions /opt/app-root -P

-# We have to first upgrade pip to at least 19.3 because:
-# * pip < 9 does not support different packages' versions for Python 2/3
-# * pip < 19.3 does not support manylinux2014 wheels. Only manylinux2014 wheels
-# support platforms like ppc64le, aarch64 or armv7
-echo "---> Upgrading pip to version 19.3.1 ..."
-if ! pip install -U "pip==19.3.1"; then
- echo "WARNING: Installation of 'pip==19.3.1' failed, trying again from official PyPI with pip --isolated install"
- pip install --isolated -U "pip==19.3.1"
-fi
-
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" ]]; then
echo "---> Upgrading pip to latest version ..."
- if ! pip install -U pip setuptools wheel; then
+ if ! pip install --no-cache-dir --disable-pip-version-check -U pip setuptools wheel; then
echo "WARNING: Installation of the latest pip,setuptools and wheel failed, trying again from official PyPI with pip --isolated install"
- pip install --isolated -U pip setuptools wheel
+ pip install --no-cache-dir --disable-pip-version-check --isolated -U pip setuptools wheel
fi
fi

-if [[ ! -z "$ENABLE_PIPENV" ]]; then
- if [[ ! -z "$PIN_PIPENV_VERSION" ]]; then
- # Add == as a prefix to pipenv version, if defined
- PIN_PIPENV_VERSION="==$PIN_PIPENV_VERSION"
- fi
- install_tool "pipenv" "$PIN_PIPENV_VERSION"
- echo "---> Installing dependencies via pipenv ..."
- if [[ -f Pipfile ]]; then
- pipenv install --deploy
- elif [[ -f requirements.txt ]]; then
- pipenv install -r requirements.txt
- fi
- # pipenv check
-elif [[ ! -z "$ENABLE_MICROPIPENV" ]]; then
- install_tool "micropipenv" "[toml]"
- echo "---> Installing dependencies via micropipenv ..."
- # micropipenv detects Pipfile.lock and requirements.txt in this order
- micropipenv install --deploy
-elif [[ -f requirements.txt ]]; then
- echo "---> Installing dependencies ..."
- pip install -r requirements.txt
-fi
+thamos install

if [[ -f setup.py && -z "$DISABLE_SETUP_PY_PROCESSING" ]]; then
echo "---> Installing application ..."
- pip install .
+ pip install --no-cache-dir --disable-pip-version-check .
fi

if should_collectstatic; then
4 changes: 2 additions & 2 deletions ubi8-py36/s2i_assemble.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/assemble 2021-12-07 00:04:23.680648366 -0500
+++ b/assemble 2021-12-07 00:04:15.508632870 -0500
--- a/assemble 2021-12-07 00:04:23.680648366 -0500
+++ b/assemble 2021-12-07 00:04:15.508632870 -0500
@@ -18,38 +18,8 @@
fi
}
Expand Down
4 changes: 2 additions & 2 deletions ubi8-py38/s2i_assemble.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/assemble 2021-12-07 00:00:27.196199956 -0500
+++ b/assemble 2021-12-07 00:00:32.284209605 -0500
--- a/assemble 2021-12-07 00:00:27.196199956 -0500
+++ b/assemble 2021-12-07 00:00:32.284209605 -0500
@@ -14,38 +14,8 @@
python3.8 -m venv $1
}
Expand Down
4 changes: 2 additions & 2 deletions ubi8-py39/s2i_assemble.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- a/assemble 2021-12-07 00:00:27.196199956 -0500
+++ b/assemble 2021-12-07 00:00:32.284209605 -0500
--- a/assemble 2021-12-07 00:00:27.196199956 -0500
+++ b/assemble 2021-12-07 00:00:32.284209605 -0500
@@ -14,38 +14,8 @@
python3.9 -m venv $1
}
Expand Down

0 comments on commit 2f737fe

Please sign in to comment.