|
| 1 | +FROM --platform=linux/s390x docker.io/ubuntu:24.04 as base |
| 2 | + |
| 3 | +# Language variables |
| 4 | +ENV LC_ALL=C.UTF-8 |
| 5 | +ENV LANG=C.UTF-8 |
| 6 | +ENV LANGUAGE=C.UTF-8 |
| 7 | + |
| 8 | +# Installed needed OS packages. This is to support all |
| 9 | +# the binary builds (torch, vision, audio, text, data) |
| 10 | +RUN apt update ; apt upgrade -y |
| 11 | +RUN apt install -y \ |
| 12 | + build-essential \ |
| 13 | + autoconf \ |
| 14 | + automake \ |
| 15 | + bzip2 \ |
| 16 | + curl \ |
| 17 | + diffutils \ |
| 18 | + file \ |
| 19 | + git \ |
| 20 | + make \ |
| 21 | + patch \ |
| 22 | + perl \ |
| 23 | + unzip \ |
| 24 | + util-linux \ |
| 25 | + wget \ |
| 26 | + which \ |
| 27 | + xz-utils \ |
| 28 | + less \ |
| 29 | + zstd \ |
| 30 | + cmake \ |
| 31 | + python3 \ |
| 32 | + python3-dev \ |
| 33 | + python3-setuptools \ |
| 34 | + python3-yaml \ |
| 35 | + python3-typing-extensions \ |
| 36 | + libblas-dev \ |
| 37 | + libopenblas-dev \ |
| 38 | + liblapack-dev \ |
| 39 | + libatlas-base-dev |
| 40 | + |
| 41 | +# git236+ would refuse to run git commands in repos owned by other users |
| 42 | +# Which causes version check to fail, as pytorch repo is bind-mounted into the image |
| 43 | +# Override this behaviour by treating every folder as safe |
| 44 | +# For more details see https://github.com/pytorch/pytorch/issues/78659#issuecomment-1144107327 |
| 45 | +RUN git config --global --add safe.directory "*" |
| 46 | + |
| 47 | +FROM base as openssl |
| 48 | +# Install openssl (this must precede `build python` step) |
| 49 | +# (In order to have a proper SSL module, Python is compiled |
| 50 | +# against a recent openssl [see env vars above], which is linked |
| 51 | +# statically. We delete openssl afterwards.) |
| 52 | +ADD ./common/install_openssl.sh install_openssl.sh |
| 53 | +RUN bash ./install_openssl.sh && rm install_openssl.sh |
| 54 | +ENV SSL_CERT_FILE=/opt/_internal/certs.pem |
| 55 | + |
| 56 | +# EPEL for cmake |
| 57 | +FROM base as patchelf |
| 58 | +# Install patchelf |
| 59 | +ADD ./common/install_patchelf.sh install_patchelf.sh |
| 60 | +RUN bash ./install_patchelf.sh && rm install_patchelf.sh |
| 61 | +RUN cp $(which patchelf) /patchelf |
| 62 | + |
| 63 | +FROM patchelf as python |
| 64 | +# build python |
| 65 | +COPY manywheel/build_scripts /build_scripts |
| 66 | +ADD ./common/install_cpython.sh /build_scripts/install_cpython.sh |
| 67 | +RUN bash build_scripts/build.sh && rm -r build_scripts |
| 68 | + |
| 69 | +FROM openssl as final |
| 70 | +COPY --from=python /opt/python /opt/python |
| 71 | +COPY --from=python /opt/_internal /opt/_internal |
| 72 | +COPY --from=python /opt/python/cp39-cp39/bin/auditwheel /usr/local/bin/auditwheel |
| 73 | +COPY --from=patchelf /usr/local/bin/patchelf /usr/local/bin/patchelf |
0 commit comments