From dd0b6194b9688aac29f62a6b4c64abf59a1016e5 Mon Sep 17 00:00:00 2001 From: Nodude <75137537+NodudeWasTaken@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:57:27 +0200 Subject: [PATCH 1/4] Added cuda push to dockerhub script --- docker/ci/x86_64/Dockerfile | 37 +++++++++++++++++++++++++++++++++ docker/ci/x86_64/docker_push.sh | 21 ++++++++++--------- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile index 343c3c4a6cd..f9b9b0bcb70 100644 --- a/docker/ci/x86_64/Dockerfile +++ b/docker/ci/x86_64/Dockerfile @@ -20,3 +20,40 @@ ENV STASH_CONFIG_FILE=/root/.stash/config.yml EXPOSE 9999 CMD ["stash"] + +FROM --platform=$TARGETPLATFORM nvidia/cuda:12.2.0-base-ubuntu22.04 AS cuda_app +COPY --from=binary /stash /usr/bin/ +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update && apt-get install -y \ + gcc \ + python3-dev \ + python3 \ + python3-pip \ + python3-requests \ + python3-requests-toolbelt \ + python3-lxml \ + ffmpeg \ + libvips-tools \ + ruby \ + gem \ + tzdata \ + build-essential \ + wget \ + && pip3 install mechanicalsoup cloudscraper bencoder.pyx \ + && gem install faraday +ENV LANG C.UTF-8 +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES=video,utility +ENV STASH_CONFIG_FILE=/root/.stash/config.yml + +# NVENC Patch +RUN mkdir -p /usr/local/bin /patched-lib +RUN wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh -O /usr/local/bin/patch.sh +RUN wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/docker-entrypoint.sh -O /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/patch.sh /usr/local/bin/docker-entrypoint.sh /usr/bin/stash + +# Clean +RUN apt-get remove -y build-essential wget && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* + +EXPOSE 9999 +ENTRYPOINT ["docker-entrypoint.sh", "stash"] diff --git a/docker/ci/x86_64/docker_push.sh b/docker/ci/x86_64/docker_push.sh index 7ca5ff201f8..e0ecaca0082 100644 --- a/docker/ci/x86_64/docker_push.sh +++ b/docker/ci/x86_64/docker_push.sh @@ -1,14 +1,15 @@ #!/bin/bash -DOCKER_TAGS="" - -for TAG in "$@" -do - DOCKER_TAGS="$DOCKER_TAGS -t stashapp/stash:$TAG" -done - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -# must build the image from dist directory -docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push $DOCKER_TAGS -f docker/ci/x86_64/Dockerfile dist/ - +# Build the main image from the dist directory +docker buildx build \ + --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push \ + $(for TAG in "$@"; do echo -n "-t stashapp/stash:$TAG "; done) \ + -f docker/ci/x86_64/Dockerfile dist/ --target app + +# Build the CUDA image from the dist directory +docker buildx build \ + --platform linux/amd64,linux/arm64 --push \ + $(for TAG in "$@"; do echo -n "-t stashapp/stash:$TAG-cuda "; done) \ + -f docker/ci/x86_64/Dockerfile dist/ --target cuda_app From 394d14b1704d7b1e736b7f216bd8ed20bc861d7b Mon Sep 17 00:00:00 2001 From: Nodude <75137537+NodudeWasTaken@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:00:00 +0200 Subject: [PATCH 2/4] Less layers --- docker/ci/x86_64/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile index f9b9b0bcb70..2748815cee1 100644 --- a/docker/ci/x86_64/Dockerfile +++ b/docker/ci/x86_64/Dockerfile @@ -47,10 +47,10 @@ ENV NVIDIA_DRIVER_CAPABILITIES=video,utility ENV STASH_CONFIG_FILE=/root/.stash/config.yml # NVENC Patch -RUN mkdir -p /usr/local/bin /patched-lib -RUN wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh -O /usr/local/bin/patch.sh -RUN wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/docker-entrypoint.sh -O /usr/local/bin/docker-entrypoint.sh -RUN chmod +x /usr/local/bin/patch.sh /usr/local/bin/docker-entrypoint.sh /usr/bin/stash +RUN mkdir -p /usr/local/bin /patched-lib \ + && wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh -O /usr/local/bin/patch.sh \ + && wget https://raw.githubusercontent.com/keylase/nvidia-patch/master/docker-entrypoint.sh -O /usr/local/bin/docker-entrypoint.sh \ + && chmod +x /usr/local/bin/patch.sh /usr/local/bin/docker-entrypoint.sh /usr/bin/stash # Clean RUN apt-get remove -y build-essential wget && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* From a237f6825b425490fbb01ed389798de7e8291ab9 Mon Sep 17 00:00:00 2001 From: Nodude <75137537+NodudeWasTaken@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:05:36 +0200 Subject: [PATCH 3/4] Remember to add the intel driver --- docker/ci/x86_64/Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile index 2748815cee1..3252f79559b 100644 --- a/docker/ci/x86_64/Dockerfile +++ b/docker/ci/x86_64/Dockerfile @@ -26,14 +26,10 @@ COPY --from=binary /stash /usr/bin/ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y \ gcc \ - python3-dev \ - python3 \ - python3-pip \ - python3-requests \ - python3-requests-toolbelt \ - python3-lxml \ + python3-dev python3 python3-pip python3-requests python3-requests-toolbelt python3-lxml \ ffmpeg \ libvips-tools \ + intel-media-va-driver-non-free vainfo \ ruby \ gem \ tzdata \ From 1b1581e61a0d5d1f15cc4f18af2600c7fb3ddc52 Mon Sep 17 00:00:00 2001 From: NodudeWasTaken <75137537+NodudeWasTaken@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:22:17 +0200 Subject: [PATCH 4/4] Downgrade CUDA version to bring it inline with the dev-build version --- docker/ci/x86_64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile index 3252f79559b..121b127b22e 100644 --- a/docker/ci/x86_64/Dockerfile +++ b/docker/ci/x86_64/Dockerfile @@ -21,7 +21,7 @@ ENV STASH_CONFIG_FILE=/root/.stash/config.yml EXPOSE 9999 CMD ["stash"] -FROM --platform=$TARGETPLATFORM nvidia/cuda:12.2.0-base-ubuntu22.04 AS cuda_app +FROM --platform=$TARGETPLATFORM nvidia/cuda:12.0.1-base-ubuntu22.04 AS cuda_app COPY --from=binary /stash /usr/bin/ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y \