diff --git a/.github/workflows/docker-extras.yml b/.github/workflows/docker-extras.yml index 3652731f..127030ef 100644 --- a/.github/workflows/docker-extras.yml +++ b/.github/workflows/docker-extras.yml @@ -36,7 +36,7 @@ jobs: with: context: docker file: docker/Dockerfile.torchserve - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 push: true tags: iqtlabs/gamutrf-torchserve:${{ steps.change_version.outputs.VERSION }} if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' diff --git a/docker/Dockerfile.torchserve b/docker/Dockerfile.torchserve index a592fbdb..9b11c004 100644 --- a/docker/Dockerfile.torchserve +++ b/docker/Dockerfile.torchserve @@ -1,5 +1,19 @@ -FROM ubuntu:22.04 as shader-compiler +FROM --platform=$BUILDPLATFORM ubuntu:22.04 as git-cloner +WORKDIR /root +RUN apt-get update && \ + apt-get install -y \ + ca-certificates \ + git \ + python3 +RUN git clone https://github.com/google/shaderc -b v2023.6 +RUN git clone https://github.com/pytorch/pytorch -b v2.1.0 +RUN git clone https://github.com/pytorch/serve -b v0.8.2 +WORKDIR /root/shaderc +RUN ./utils/git-sync-deps +WORKDIR /root/pytorch +RUN git submodule update --init --recursive +FROM ubuntu:22.04 as shader-compiler WORKDIR /root RUN apt-get update && \ apt-get install -y \ @@ -9,18 +23,19 @@ RUN apt-get update && \ ninja-build \ python3-dev \ python3-pip -RUN git clone https://github.com/google/shaderc -b v2023.6 -WORKDIR /root/shaderc -RUN ./utils/git-sync-deps +COPY --from=git-cloner /root/shaderc /root/shaderc WORKDIR /root/shaderc/build RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DSHADERC_SKIP_TESTS=on .. && ninja && ninja install FROM ubuntu:22.04 as pytorch-compiler -# ENV USE_CUDA=1 +ENV DEBIAN_FRONTEND=noninteractive +ENV USE_CUDA=0 ENV USE_VULKAN=1 ENV USE_VULKAN_SHADERC_RUNTIME=1 ENV USE_VULKAN_WRAPPER=0 WORKDIR /root +COPY --from=shader-compiler /usr/local /usr/local +COPY --from=git-cloner /root/pytorch /root/pytorch RUN apt-get update && \ apt-get install -y \ build-essential \ @@ -30,8 +45,6 @@ RUN apt-get update && \ ninja-build \ python3-dev \ python3-pip -COPY --from=shader-compiler /usr/local /usr/local -RUN git clone https://github.com/pytorch/pytorch -b v2.1.0 WORKDIR /root/pytorch COPY pytorch-patch.txt /root/pytorch RUN patch -p1 < pytorch-patch.txt @@ -51,7 +64,7 @@ RUN apt-get update && \ python3-dev \ python3-pip WORKDIR /root -RUN git clone https://github.com/pytorch/serve -b v0.8.2 +COPY --from=git-cloner /root/serve /root/serve WORKDIR /root/serve COPY torchserve-patch.txt /root/serve RUN patch -p1 < torchserve-patch.txt