Skip to content

Commit 12f3f31

Browse files
committed
Updated Dockerfile.hf for multi-arch build for amd64 and s390x
Signed-off-by: satyamg1620 <Satyam.Gupta.3@ibm.com>
1 parent bb4ea8a commit 12f3f31

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

detectors/Dockerfile.hf

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,27 @@ RUN microdnf update -y && \
44
python-pip python-devel && \
55
pip install --upgrade --no-cache-dir pip wheel && \
66
microdnf clean all
7-
RUN pip install --no-cache-dir torch
87

9-
# FROM icr.io/fm-stack/ubi9-minimal-py39-torch as builder
8+
ARG TARGETARCH
9+
ENV TORCH_VERSION=2.7.1
10+
ARG _GLIBCXX_USE_CXX11_ABI=1
11+
12+
RUN if [ "$TARGETARCH" = "s390x" ]; then \
13+
microdnf install -y git gcc-toolset-13 make wget unzip rust cargo gcc-gfortran python3-devel openblas-devel pkgconfig && \
14+
microdnf clean all && \
15+
pip install --upgrade pip cmake setuptools wheel && \
16+
source /opt/rh/gcc-toolset-13/enable && \
17+
git clone --recursive https://github.com/pytorch/pytorch.git -b v${TORCH_VERSION} && \
18+
cd pytorch && pip install -r requirements.txt && \
19+
python setup.py develop && \
20+
rm -f dist/torch*+git*whl && \
21+
PYTORCH_BUILD_VERSION=${TORCH_VERSION} PYTORCH_BUILD_NUMBER=1 pip wheel . --wheel-dir /torchwheels/ && \
22+
pip install /torchwheels/*.whl; \
23+
else \
24+
pip install --no-cache-dir torch; \
25+
fi
26+
27+
1028
FROM base as builder
1129

1230
COPY ./common/requirements.txt .
@@ -15,6 +33,11 @@ RUN pip install --no-cache-dir -r requirements.txt
1533
COPY ./huggingface/requirements.txt .
1634
RUN pip install --no-cache-dir -r requirements.txt
1735

36+
RUN if [ "$TARGETARCH" = "s390x" ]; then \
37+
pip install --no-cache-dir uvicorn; \
38+
fi
39+
40+
1841
FROM builder
1942

2043
WORKDIR /app

0 commit comments

Comments
 (0)