diff --git a/docker/ci/x86_64/Dockerfile b/docker/ci/x86_64/Dockerfile index 343c3c4a6cd..121b127b22e 100644 --- a/docker/ci/x86_64/Dockerfile +++ b/docker/ci/x86_64/Dockerfile @@ -20,3 +20,36 @@ ENV STASH_CONFIG_FILE=/root/.stash/config.yml EXPOSE 9999 CMD ["stash"] + +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 \ + gcc \ + 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 \ + 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 \ + && 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/* + +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