|
| 1 | +FROM --platform=linux/s390x docker.io/redhat/ubi9 as base |
| 2 | + |
| 3 | +# earliest available version in ubi9 |
| 4 | +ARG DEVTOOLSET_VERSION=12 |
| 5 | + |
| 6 | +# Language variabes |
| 7 | +ENV LC_ALL=en_US.UTF-8 |
| 8 | +ENV LANG=en_US.UTF-8 |
| 9 | +ENV LANGUAGE=en_US.UTF-8 |
| 10 | + |
| 11 | +# Installed needed OS packages. This is to support all |
| 12 | +# the binary builds (torch, vision, audio, text, data) |
| 13 | +RUN dnf -y install redhat-release |
| 14 | +RUN dnf -y update |
| 15 | +RUN dnf install -y --allowerasing \ |
| 16 | + autoconf \ |
| 17 | + automake \ |
| 18 | + bzip2 \ |
| 19 | + curl \ |
| 20 | + diffutils \ |
| 21 | + file \ |
| 22 | + git \ |
| 23 | + make \ |
| 24 | + patch \ |
| 25 | + perl \ |
| 26 | + unzip \ |
| 27 | + util-linux \ |
| 28 | + wget \ |
| 29 | + which \ |
| 30 | + xz \ |
| 31 | + less \ |
| 32 | + zstd \ |
| 33 | + libgomp \ |
| 34 | + cmake \ |
| 35 | + gcc-toolset-${DEVTOOLSET_VERSION}-gcc \ |
| 36 | + gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ \ |
| 37 | + gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran \ |
| 38 | + gcc-toolset-${DEVTOOLSET_VERSION}-binutils |
| 39 | + |
| 40 | +# Ensure the expected gcc-toolset is used |
| 41 | +ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH |
| 42 | +ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH |
| 43 | + |
| 44 | + |
| 45 | +# git236+ would refuse to run git commands in repos owned by other users |
| 46 | +# Which causes version check to fail, as pytorch repo is bind-mounted into the image |
| 47 | +# Override this behaviour by treating every folder as safe |
| 48 | +# For more details see https://github.com/pytorch/pytorch/issues/78659#issuecomment-1144107327 |
| 49 | +RUN git config --global --add safe.directory "*" |
| 50 | + |
| 51 | +FROM base as openssl |
| 52 | +# Install openssl (this must precede `build python` step) |
| 53 | +# (In order to have a proper SSL module, Python is compiled |
| 54 | +# against a recent openssl [see env vars above], which is linked |
| 55 | +# statically. We delete openssl afterwards.) |
| 56 | +ADD ./common/install_openssl.sh install_openssl.sh |
| 57 | +RUN bash ./install_openssl.sh && rm install_openssl.sh |
| 58 | +ENV SSL_CERT_FILE=/opt/_internal/certs.pem |
| 59 | + |
| 60 | +FROM openssl as final |
| 61 | +# remove unncessary python versions |
| 62 | +RUN rm -rf /opt/python/cp26-cp26m /opt/_internal/cpython-2.6.9-ucs2 |
| 63 | +RUN rm -rf /opt/python/cp26-cp26mu /opt/_internal/cpython-2.6.9-ucs4 |
| 64 | +RUN rm -rf /opt/python/cp33-cp33m /opt/_internal/cpython-3.3.6 |
| 65 | +RUN rm -rf /opt/python/cp34-cp34m /opt/_internal/cpython-3.4.6 |
0 commit comments