Skip to content

Commit 2e5a39f

Browse files
updated dockerfile
1 parent 4c7b09c commit 2e5a39f

File tree

2 files changed

+97
-33
lines changed

2 files changed

+97
-33
lines changed
Lines changed: 96 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,107 @@
1-
# Use UBI 9.3 as base image
2-
FROM registry.access.redhat.com/ubi9/ubi:9.3
1+
# Use the manylinux_2_28 base image for ppc64le
2+
FROM quay.io/pypa/manylinux_2_28_ppc64le as base
33

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
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
1010

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"
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
1614

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
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+
2068

21-
COPY requirements.txt .
22-
# Install Python packages via pip
23-
RUN pip install wheel setuptools pyyaml typing_extensions expecttest
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
2474

25-
#RUN source /opt/rh/gcc-toolset-13/enable && pip install -r requirements.txt
26-
RUN pip install -r requirements.txt
75+
# Configure git to avoid safe directory issues
76+
RUN git config --global --add safe.directory "*"
2777

28-
# Copy the PyTorch source code into the container
29-
COPY . /workspace/pytorch
78+
# installed python doesn't have development parts. Rebuild it from scratch
79+
RUN /bin/rm -rf /opt/_internal /opt/python /usr/local/*/*
3080

31-
WORKDIR /workspace/pytorch
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
3287

33-
# Ensure submodules are initialized and updated
34-
RUN git submodule update --init --recursive
88+
RUN alternatives --set python /usr/bin/python3.12
89+
RUN alternatives --set python3 /usr/bin/python3.12
3590

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
91+
RUN pip-3.12 install typing_extensions
3992

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
93+
# Install required Python packages
94+
#RUN pip install --upgrade pip
95+
#RUN pip install typing_extensions pyyaml setuptools
96+
97+
# Install test dependencies
98+
RUN dnf install -y \
99+
protobuf-devel \
100+
protobuf-c-devel \
101+
protobuf-lite-devel \
102+
wget \
103+
patch
43104

105+
# Set default entrypoint
106+
ENTRYPOINT []
107+
CMD ["/bin/bash"]

.github/workflows/ppc64le.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
jobs:
1414
linux-ppc64le-docker-image-build:
1515
name: Build docker image for ppc64le
16-
runs-on: ubuntu-24.04-ppc64le-dev
16+
runs-on: ubuntu-24.04-ppc64le
1717
steps:
1818
- name: Checkout repository
1919
uses: actions/checkout@v3

0 commit comments

Comments
 (0)