diff --git a/codeserver/ubi9-python-3.12/Dockerfile.cpu b/codeserver/ubi9-python-3.12/Dockerfile.cpu index c349b924d..65a0c43c7 100644 --- a/codeserver/ubi9-python-3.12/Dockerfile.cpu +++ b/codeserver/ubi9-python-3.12/Dockerfile.cpu @@ -57,7 +57,7 @@ COPY ${CODESERVER_SOURCE_CODE}/devel_env_setup.sh ./ # the final stage with the necessary permissions to consume from cache RUN --mount=type=cache,target=/root/.cache/uv \ pip install --no-cache-dir uv && \ - # the devel script is ppc64le specific - sets up build-time dependencies + # the devel script is ppc64le and s390x specific - sets up build-time dependencies source ./devel_env_setup.sh && \ # This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`, # we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common. @@ -90,7 +90,7 @@ RUN dnf -y upgrade --refresh --nobest --skip-broken --nodocs --noplugins --setop # upgrade first to avoid fixable vulnerabilities end # Install useful OS packages -RUN dnf install -y perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum +RUN dnf install -y tar perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/dnf # (ARCH-ppc64le): since wheels are compiled from source, we need shared libs available at runtime RUN --mount=type=cache,from=whl-cache,source=/root/OpenBLAS,target=/OpenBlas,rw \ @@ -139,9 +139,9 @@ USER 0 WORKDIR /opt/app-root/bin # Install useful OS packages -RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum +RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/dnf -# wait for rpm-base stage (rpm builds for ppc64le) +# wait for rpm-base stage (rpm builds for ppc64le and s390x) COPY --from=rpm-base /tmp/control /dev/null # Install code-server @@ -253,7 +253,7 @@ COPY --from=whl-cache /tmp/control /dev/null RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=cache,from=whl-cache,source=/wheelsdir/,target=/wheelsdir/,rw \ bash -c ' \ - if [[ $(uname -m) == "ppc64le" ]]; then \ + if [[ $(uname -m) == "ppc64le" ]] || [[ $(uname -m) == "s390x" ]]; then \ uv pip install /wheelsdir/*.whl; \ fi ' # install packages as USER 0 (this will allow us to consume uv cache) diff --git a/codeserver/ubi9-python-3.12/devel_env_setup.sh b/codeserver/ubi9-python-3.12/devel_env_setup.sh index 4c30e8f82..49787e5a4 100755 --- a/codeserver/ubi9-python-3.12/devel_env_setup.sh +++ b/codeserver/ubi9-python-3.12/devel_env_setup.sh @@ -63,6 +63,35 @@ build_pyarrow() { rm -rf ${TEMP_BUILD_DIR} } + # Additional dev tools only for s390x \ +if [[ $(uname -m) == "s390x" ]]; then \ + + dnf install -y perl mesa-libGL skopeo libxcrypt-compat python3.12-devel pkgconf-pkg-config gcc gcc-gfortran gcc-c++ ninja-build make openssl-devel python3-devel pybind11-devel autoconf automake libtool cmake openblas-devel libjpeg-devel zlib-devel libtiff-devel freetype-devel lcms2-devel libwebp-devel git tar wget && \ + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ + dnf install -y cmake gcc gcc-toolset-13 fribidi-devel lcms2-devel openjpeg2-devel libraqm-devel libimagequant-devel tcl-devel tk-devel && \ + dnf clean all && rm -rf /var/cache/dnf; + + # install rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + + source /opt/rh/gcc-toolset-13/enable + source "$HOME/.cargo/env" + + export MAX_JOBS=${MAX_JOBS:-$(nproc)} + + if [[ $(uname -m) == "s390x" ]]; then + echo "Checking OpenBLAS pkg-config..." + pkg-config --exists openblas || echo "Warning: openblas.pc not found" + fi + + export CMAKE_ARGS="-DPython3_EXECUTABLE=python -DCMAKE_PREFIX_PATH=/usr/local" + + PYARROW_VERSION=$(grep -A1 '"pyarrow"' pylock.toml | grep -Eo '\b[0-9\.]+\b') + build_pyarrow ${PYARROW_VERSION} + uv pip install ${WHEEL_DIR}/*.whl +fi + + if [[ $(uname -m) == "ppc64le" ]]; then # install development packages dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm @@ -101,7 +130,8 @@ if [[ $(uname -m) == "ppc64le" ]]; then build_pillow ${PILLOW_VERSION} uv pip install ${WHEEL_DIR}/*.whl -else - # only for mounting on non-ppc64le - mkdir -p /root/OpenBLAS/ +fi +if [[ $(uname -m) != "ppc64le" ]]; then + # only for mounting on other ppc64le + mkdir -p /root/OpenBLAS/ fi diff --git a/codeserver/ubi9-python-3.12/get_code_server_rpm.sh b/codeserver/ubi9-python-3.12/get_code_server_rpm.sh index f293eabe7..8c2c087f0 100755 --- a/codeserver/ubi9-python-3.12/get_code_server_rpm.sh +++ b/codeserver/ubi9-python-3.12/get_code_server_rpm.sh @@ -17,7 +17,7 @@ UNAME_TO_GOARCH["s390x"]="s390x" ARCH="${UNAME_TO_GOARCH[$(uname -m)]}" -if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ||"$ARCH" == "ppc64le" ]]; then +if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" || "$ARCH" == "ppc64le" || "$ARCH" == "s390x" ]]; then export MAX_JOBS=${MAX_JOBS:-$(nproc)} export NODE_VERSION=${NODE_VERSION:-22.18.0} @@ -62,12 +62,57 @@ if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ||"$ARCH" == "ppc64le" ]]; then # build codeserver git clone --depth 1 --branch "${CODESERVER_VERSION}" --recurse-submodules --shallow-submodules https://github.com/coder/code-server.git cd code-server + +#patch taken from vscodium s390x IBM : https://github.com/VSCodium/vscodium/blob/master/patches/linux/reh/s390x/arch-4-s390x-package.json.patch +if [[ "$ARCH" == "s390x" ]]; then +cat > s390x.patch <