-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding required files for f35-py310 S2I image to built
including linting of s2i_assemble.patches for all ubi overlays so pre-commit can pass
- Loading branch information
1 parent
8946641
commit 2f737fe
Showing
8 changed files
with
950 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
thamos | ||
micropipenv[toml] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters