Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github action to publish a CUDA build alongside the alpine one #4091

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docker/ci/x86_64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
21 changes: 11 additions & 10 deletions docker/ci/x86_64/docker_push.sh
Original file line number Diff line number Diff line change
@@ -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