1FROM quay.io/pypa/manylinux_2_28_aarch64 as base 2 3# Graviton needs GCC 10 or above for the build. GCC12 is the default version in almalinux-8. 4ARG GCCTOOLSET_VERSION=11 5 6# Language variabes 7ENV LC_ALL=en_US.UTF-8 8ENV LANG=en_US.UTF-8 9ENV LANGUAGE=en_US.UTF-8 10 11# Installed needed OS packages. This is to support all 12# the binary builds (torch, vision, audio, text, data) 13RUN yum -y install epel-release 14RUN yum -y update 15RUN yum install -y \ 16 autoconf \ 17 automake \ 18 bison \ 19 bzip2 \ 20 curl \ 21 diffutils \ 22 file \ 23 git \ 24 less \ 25 libffi-devel \ 26 libgomp \ 27 make \ 28 openssl-devel \ 29 patch \ 30 perl \ 31 unzip \ 32 util-linux \ 33 wget \ 34 which \ 35 xz \ 36 yasm \ 37 zstd \ 38 sudo \ 39 gcc-toolset-${GCCTOOLSET_VERSION}-toolchain 40 41# Ensure the expected devtoolset is used 42ENV PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/bin:$PATH 43ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH 44 45# git236+ would refuse to run git commands in repos owned by other users 46# Which causes version check to fail, as pytorch repo is bind-mounted into the image 47# Override this behaviour by treating every folder as safe 48# For more details see https://github.com/pytorch/pytorch/issues/78659#issuecomment-1144107327 49RUN git config --global --add safe.directory "*" 50 51FROM base as final 52 53# remove unncessary python versions 54RUN rm -rf /opt/python/cp26-cp26m /opt/_internal/cpython-2.6.9-ucs2 55RUN rm -rf /opt/python/cp26-cp26mu /opt/_internal/cpython-2.6.9-ucs4 56RUN rm -rf /opt/python/cp33-cp33m /opt/_internal/cpython-3.3.6 57RUN rm -rf /opt/python/cp34-cp34m /opt/_internal/cpython-3.4.6 58