xref: /aosp_15_r20/external/pytorch/.ci/docker/manywheel/Dockerfile_s390x (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1FROM --platform=linux/s390x docker.io/ubuntu:24.04 as base
2
3# Language variables
4ENV LC_ALL=C.UTF-8
5ENV LANG=C.UTF-8
6ENV LANGUAGE=C.UTF-8
7
8# Installed needed OS packages. This is to support all
9# the binary builds (torch, vision, audio, text, data)
10RUN apt update ; apt upgrade -y
11RUN 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
45RUN git config --global --add safe.directory "*"
46
47FROM 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.)
52ADD ./common/install_openssl.sh install_openssl.sh
53RUN bash ./install_openssl.sh && rm install_openssl.sh
54ENV SSL_CERT_FILE=/opt/_internal/certs.pem
55
56# EPEL for cmake
57FROM base as patchelf
58# Install patchelf
59ADD ./common/install_patchelf.sh install_patchelf.sh
60RUN bash ./install_patchelf.sh && rm install_patchelf.sh
61RUN cp $(which patchelf) /patchelf
62
63FROM patchelf as python
64# build python
65COPY manywheel/build_scripts /build_scripts
66ADD ./common/install_cpython.sh /build_scripts/install_cpython.sh
67RUN bash build_scripts/build.sh && rm -r build_scripts
68
69FROM openssl as final
70COPY --from=python             /opt/python                           /opt/python
71COPY --from=python             /opt/_internal                        /opt/_internal
72COPY --from=python             /opt/python/cp39-cp39/bin/auditwheel /usr/local/bin/auditwheel
73COPY --from=patchelf           /usr/local/bin/patchelf               /usr/local/bin/patchelf
74