Skip to content

Commit 5258196

Browse files
authored
Merge pull request #49 from satyamg1620/multiarch
Updated Dockerfile.hf for multi-arch build for amd64 and s390x
2 parents 9cd2d2c + 65ca4e6 commit 5258196

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

detectors/Dockerfile.hf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ RUN microdnf update -y && \
1010
microdnf install -y --nodocs \
1111
git gcc-toolset-13 rust cargo wget unzip && \
1212
pip install --upgrade --no-cache-dir 'cmake<4' ; \
13+
elif [ "$TARGETARCH" = "s390x" ]; then \
14+
microdnf install -y --nodocs \
15+
git gcc-toolset-13 make wget unzip rust cargo \
16+
gcc-gfortran python3-devel openblas-devel pkgconfig && \
17+
pip install --upgrade --no-cache-dir 'cmake<4' \
18+
setuptools wheel ; \
1319
fi && \
1420
microdnf clean all
1521

1622

17-
RUN if [ "$TARGETARCH" != "ppc64le" ]; then \
23+
RUN if [ "$TARGETARCH" != "ppc64le" ] && [ "$TARGETARCH" != "s390x" ]; then \
1824
pip install --no-cache-dir torch ; \
1925
fi
2026

@@ -29,7 +35,7 @@ ARG TARGETARCH
2935
ENV TORCH_VERSION=2.6.0
3036
ENV PATH="$HOME/.cargo/bin:$PATH"
3137

32-
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
38+
RUN if [ "$TARGETARCH" = "ppc64le" ] || [ "$TARGETARCH" = "s390x" ]; then \
3339
source /opt/rh/gcc-toolset-13/enable && \
3440
git clone --recursive https://github.com/pytorch/pytorch.git -b v${TORCH_VERSION} && \
3541
cd pytorch && pip install -r requirements.txt && \
@@ -64,7 +70,7 @@ ARG TARGETARCH
6470

6571
# Install PyTorch for ppc64le
6672
RUN --mount=type=bind,from=torch-builder,source=/tmp/,target=/wheels/,ro \
67-
if [ "$TARGETARCH" = "ppc64le" ]; then \
73+
if [ "$TARGETARCH" = "ppc64le" ] || [ "$TARGETARCH" = "s390x" ]; then \
6874
HOME=/root pip install /wheels/torchwheels/*.whl ;\
6975
fi
7076

@@ -78,7 +84,7 @@ COPY ./common/requirements.txt .
7884
RUN pip install --no-cache-dir -r requirements.txt
7985

8086
COPY ./huggingface/requirements.txt .
81-
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
87+
RUN if [ "$TARGETARCH" = "ppc64le" ] || [ "$TARGETARCH" = "s390x" ]; then \
8288
source /opt/rh/gcc-toolset-13/enable ; \
8389
fi && \
8490
pip install --no-cache-dir -r requirements.txt

0 commit comments

Comments
 (0)