1- # Use the manylinux_2_28 base image for ppc64le
2- FROM quay.io/pypa/manylinux_2_28_ppc64le as base
1+ # Use UBI 9.3 as base image
2+ FROM registry.access.redhat.com/ubi9/ubi:9.3
33
4- # Language variables
5- ENV LC_ALL=C.UTF-8
6- ENV LANG=C.UTF-8
7- ENV LANGUAGE=C.UTF-8
8-
9- ARG DEVTOOLSET_VERSION=13
10-
11- # Create symbolic links for Python 3.12
12- RUN ln -sf /opt/python/cp312-cp312/bin/python3.12 /usr/bin/python3 && \
13- ln -sf /opt/python/cp312-cp312/bin/python3.12 /usr/bin/python
14-
15- # Install required system dependencies
16- RUN yum -y install epel-release && \
17- yum -y update && \
18- yum install -y \
19- sudo \
20- autoconf \
21- automake \
22- bison \
23- bzip2 \
24- curl \
25- diffutils \
26- file \
27- git \
28- make \
29- patch \
30- perl \
31- unzip \
32- util-linux \
33- wget \
34- which \
35- xz \
36- yasm \
37- less \
38- zstd \
39- libgomp \
40- gcc-toolset-${DEVTOOLSET_VERSION}-gcc \
41- gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ \
42- gcc-toolset-${DEVTOOLSET_VERSION}-binutils \
43- gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran \
44- cmake \
45- ninja-build \
46- rust \
47- cargo \
48- llvm-devel \
49- libzstd-devel \
50- python3.12-devel \
51- python3.12-setuptools \
52- python3.12-pip \
53- python3-virtualenv \
54- python3.12-pyyaml \
55- python3.12-numpy \
56- python3.12-wheel \
57- python3.12-cryptography \
58- blas-devel \
59- openblas-devel \
60- lapack-devel \
61- atlas-devel \
62- libjpeg-devel \
63- libxslt-devel \
64- libxml2-devel \
65- openssl-devel \
66- valgrind
67-
4+ # Install necessary dependencies
5+ RUN dnf install -y \
6+ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
7+ dnf install -y git cmake ninja-build gcc-toolset-13 rust cargo zip \
8+ python3 python3-devel && \
9+ dnf clean all
6810
69- # Ensure the correct Python version is used
70- ENV PATH= /opt/python/cp312-cp312/bin:$PATH
71- # Add gcc-toolset to the path
72- ENV PATH= /opt/rh/gcc-toolset-${DEVTOOLSET_VERSION} /root/usr/bin:$PATH
73- 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
11+ ENV PATH="/opt/rh/gcc-toolset-13/root/usr/bin:$PATH"
12+ ENV MANPATH=" /opt/rh/gcc-toolset-13/root/usr/share/man"
13+ ENV INFOPATH="/opt/rh/ gcc-toolset-13/root/usr/share/info"
14+ ENV PCP_DIR=" /opt/rh/gcc-toolset-13 /root"
15+ ENV LD_LIBRARY_PATH=" /opt/rh/gcc-toolset-13 /root/usr/lib64:/opt/rh/gcc-toolset-13 /root/usr/lib"
7416
75- # Configure git to avoid safe directory issues
76- RUN git config --global --add safe.directory "*"
17+ # Set Python and pip aliases to use Python 3.9
18+ RUN ln -sf /usr/bin/python3 /usr/bin/python && \
19+ ln -sf /usr/bin/pip3 /usr/bin/pip
7720
78- # installed python doesn't have development parts. Rebuild it from scratch
79- RUN /bin/rm -rf /opt/_internal /opt/python /usr/local/*/*
21+ COPY requirements.txt .
22+ # Install Python packages via pip
23+ RUN pip install wheel setuptools pyyaml typing_extensions expecttest
8024
81- # EPEL for cmake
82- FROM base as patchelf
83- # Install patchelf
84- ADD ./common/install_patchelf.sh install_patchelf.sh
85- RUN bash ./install_patchelf.sh && rm install_patchelf.sh
86- RUN cp $(which patchelf) /patchelf
25+ #RUN source /opt/rh/gcc-toolset-13/enable && pip install -r requirements.txt
26+ RUN pip install -r requirements.txt
8727
88- FROM patchelf as python
89- # build python
90- COPY manywheel/build_scripts /build_scripts
91- ADD ./common/install_cpython.sh /build_scripts/install_cpython.sh
92- ENV SSL_CERT_FILE=
93- RUN bash build_scripts/build.sh && rm -r build_scripts
94- #RUN bash build_scripts/build.sh || (echo "Checksum verification failed!" && exit 1)
28+ # Copy the PyTorch source code into the container
29+ COPY . /workspace/pytorch
9530
96- FROM base as final
97- COPY --from=python /opt/python /opt/python
98- COPY --from=python /opt/_internal /opt/_internal
99- COPY --from=python /opt/python/cp39-cp39/bin/auditwheel /usr/local/bin/auditwheel
100- COPY --from=patchelf /usr/local/bin/patchelf /usr/local/bin/patchelf
31+ WORKDIR /workspace/pytorch
10132
102- RUN alternatives --set python /usr/bin/python3.12
103- RUN alternatives --set python3 /usr/bin/python3.12
33+ # Ensure submodules are initialized and updated
34+ RUN git submodule update --init --recursive
10435
105- RUN pip-3.12 install typing_extensions
36+ # Copy the build script and make it executable
37+ COPY .github/scripts/ppc64le-build.sh /ppc64le-build.sh
38+ RUN chmod +x /ppc64le-build.sh
10639
107- # Install required Python packages
108- #RUN pip install --upgrade pip
109- #RUN pip install typing_extensions pyyaml setuptools
110-
111- # Install test dependencies
112- RUN dnf install -y \
113- protobuf-devel \
114- protobuf-c-devel \
115- protobuf-lite-devel \
116- wget \
117- patch
40+ # Verify permissions and ensure Unix line endings
41+ RUN dos2unix /ppc64le-build.sh || sed -i 's/\r$//' /ppc64le-build.sh
42+ RUN chmod +x /ppc64le-build.sh
11843
119- # Set default entrypoint
120- ENTRYPOINT []
121- CMD ["/bin/bash"]
0 commit comments