-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d12777d
Showing
43 changed files
with
419 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: docker-cuda-build | ||
on: | ||
push: | ||
paths: | ||
- cuda.Dockerfile | ||
- stash-cuda/** | ||
- stash/** | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
file: cuda.Dockerfile | ||
tags: ghcr.io/${{ github.repository_owner }}/stash-s6:cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: docker-build | ||
on: | ||
push: | ||
paths: | ||
- alpine.Dockerfile | ||
- stash/** | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
file: alpine.Dockerfile | ||
tags: ghcr.io/${{ github.repository_owner }}/stash-s6:alpine |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM alpine:edge as s6-builder | ||
# https://github.com/just-containers/s6-overlay/releases | ||
ARG S6_OVERLAY_VERSION="3.1.6.2" | ||
ARG S6_OVERLAY_ARCH="x86_64" | ||
WORKDIR /root-out | ||
|
||
# add s6 overlay | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz | ||
|
||
# add s6 optional symlinks | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz | ||
|
||
FROM alpine:3.18 | ||
# add stash | ||
COPY --from=s6-builder /root-out/ / | ||
# ubuntu environment variables | ||
ENV HOME="/root" \ | ||
TZ="Etc/UTC" \ | ||
LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US:en" \ | ||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \ | ||
# stash environment variables | ||
STASH_PORT="9999" \ | ||
STASH_GENERATED="/data/generated" \ | ||
STASH_CACHE="/data/cache" \ | ||
STASH_METADATA="/config/metadata" \ | ||
STASH_CONFIG_FILE="/config/config.yaml" \ | ||
# python env | ||
PIP_INSTALL_TARGET="/pip-install" | ||
|
||
RUN \ | ||
echo "**** install packages ****" && \ | ||
apk add --no-cache \ | ||
bash \ | ||
ca-certificates \ | ||
curl \ | ||
ffmpeg \ | ||
python3 \ | ||
py3-pip \ | ||
shadow \ | ||
tzdata \ | ||
vips-tools \ | ||
wget && \ | ||
echo "**** create stash user and make our folders ****" && \ | ||
useradd -u 1000 -U -d /config -s /bin/false stash && \ | ||
usermod -G users stash && \ | ||
mkdir -p \ | ||
/app \ | ||
/config \ | ||
/config/.stash \ | ||
/data \ | ||
/defaults && \ | ||
echo "**** cleanup ****" | ||
|
||
COPY stash/root/ / | ||
COPY --from=stashapp/stash /usr/bin/stash /app/stash | ||
|
||
VOLUME /pip-install | ||
|
||
EXPOSE 9999 | ||
ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM alpine:edge as s6-builder | ||
# https://github.com/just-containers/s6-overlay/releases | ||
ARG S6_OVERLAY_VERSION="3.1.6.2" | ||
ARG S6_OVERLAY_ARCH="x86_64" | ||
WORKDIR /root-out | ||
|
||
# add s6 overlay | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz | ||
|
||
# add s6 optional symlinks | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz | ||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp | ||
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz | ||
|
||
# add nvenc patch | ||
ADD --chmod=0755 https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh /root-out/usr/local/bin/ | ||
|
||
FROM ubuntu:jammy | ||
# add stash | ||
COPY --from=stashapp/stash /usr/bin/stash /app/stash | ||
COPY --from=s6-builder /root-out/ / | ||
ARG DEBIAN_FRONTEND="noninteractive" | ||
# ubuntu environment variables | ||
ENV HOME="/root" \ | ||
TZ="Etc/UTC" \ | ||
LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US:en" \ | ||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \ | ||
# stash environment variables | ||
STASH_PORT="9999" \ | ||
STASH_GENERATED="/data/generated" \ | ||
STASH_CACHE="/data/cache" \ | ||
STASH_METADATA="/config/metadata" \ | ||
STASH_CONFIG_FILE="/config/config.yaml" \ | ||
# python env | ||
PIP_INSTALL_TARGET="/pip-install" \ | ||
# hardware env | ||
LIBVA_DRIVERS_PATH="/usr/local/lib/x86_64-linux-gnu/dri" \ | ||
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \ | ||
NVIDIA_VISIBLE_DEVICES="all" | ||
|
||
RUN \ | ||
echo "**** install apt-utils and locales ****" && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
apt-utils \ | ||
locales && \ | ||
echo "**** install packages ****" && \ | ||
apt-get install -y \ | ||
--no-install-recommends \ | ||
--no-install-suggests \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
libvips-tools \ | ||
python3 \ | ||
python3-pip \ | ||
tzdata \ | ||
wget && \ | ||
echo "**** generate locale ****" && \ | ||
locale-gen en_US.UTF-8 && \ | ||
echo "**** create stash user and make our folders ****" && \ | ||
useradd -u 1000 -U -d /config -s /bin/false stash && \ | ||
usermod -G users stash && \ | ||
mkdir -p \ | ||
/app \ | ||
/config \ | ||
/config/.stash \ | ||
/data \ | ||
/defaults && \ | ||
echo "**** cleanup ****" && \ | ||
apt-get autoremove && \ | ||
apt-get clean && \ | ||
rm -rf \ | ||
/tmp/* \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* \ | ||
/var/log/* | ||
|
||
COPY stash/root/ / | ||
COPY stash-cuda/root/ / | ||
|
||
EXPOSE 9999 | ||
ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM stashapp/stash as stash | ||
|
||
FROM alpine as build | ||
RUN apk add ca-certificates wget | ||
WORKDIR /tmp | ||
RUN mkdir -p \ | ||
/patched-lib && \ | ||
wget -O /tmp/patch.sh \ | ||
https://raw.githubusercontent.com/keylase/nvidia-patch/master/patch.sh && \ | ||
wget -O /tmp/docker-entrypoint.sh \ | ||
https://raw.githubusercontent.com/keylase/nvidia-patch/master/docker-entrypoint.sh && \ | ||
chmod +x \ | ||
/tmp/patch.sh \ | ||
/tmp/docker-entrypoint.sh \ | ||
|
||
# Final Runnable Image | ||
FROM nvidia/cuda:12.0.1-base-ubuntu22.04 | ||
|
||
COPY --from=stashapp/stash /usr/bin/stash /usr/bin/ | ||
RUN apt update && \ | ||
apt install -y \ | ||
libvips-tools \ | ||
ffmpeg \ | ||
python3-pip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# NVENC Patch | ||
RUN mkdir -p \ | ||
/usr/local/bin \ | ||
/patched-lib && \ | ||
COPY --from=build /tmp /usr/local/bin/ | ||
|
||
# pip packages | ||
RUN pip3 install \ | ||
requests \ | ||
bs4 \ | ||
lxml \ | ||
pystashlib \ | ||
stashapp-tools | ||
|
||
ENV LANG C.UTF-8 | ||
ENV NVIDIA_VISIBLE_DEVICES all | ||
ENV NVIDIA_DRIVER_CAPABILITIES=video,utility | ||
ENV STASH_CONFIG_FILE=/root/.stash/config.yml | ||
EXPOSE 9999 | ||
ENTRYPOINT ["docker-entrypoint.sh", "stash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM stashapp/stash as stash | ||
|
||
FROM ghcr.io/linuxserver/ffmpeg:latest | ||
|
||
COPY --from=stashapp/stash /usr/bin/stash /usr/bin/ | ||
RUN apt update && \ | ||
apt install -y \ | ||
libvips-tools \ | ||
vainfo \ | ||
python3-pip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# pip packages | ||
RUN pip3 install \ | ||
requests \ | ||
bs4 \ | ||
lxml \ | ||
pystashlib \ | ||
stashapp-tools | ||
|
||
ENV STASH_CONFIG_FILE=/root/.stash/config.yml | ||
EXPOSE 9999 | ||
ENTRYPOINT ["stash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM alpine:latest | ||
COPY --from=stashapp/stash /usr/bin/stash /usr/bin/ | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates vips-tools ffmpeg python3 py3-pip && \ | ||
pip3 install \ | ||
requests \ | ||
bs4 \ | ||
lxml \ | ||
pystashlib \ | ||
stashapp-tools | ||
|
||
ENV STASH_CONFIG_FILE=/root/.stash/config.yml | ||
EXPOSE 9999 | ||
ENTRYPOINT ["stash"] |
Empty file added
0
stash-cuda/root/etc/s6-overlay/s6-rc.d/init-nvidia-patch/dependencies.d/init-ffmpeg
Empty file.
15 changes: 15 additions & 0 deletions
15
stash-cuda/root/etc/s6-overlay/s6-rc.d/init-nvidia-patch/run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/command/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
# copied from https://github.com/keylase/nvidia-patch/blob/master/docker-entrypoint.sh | ||
echo "/patched-lib" > /etc/ld.so.conf.d/000-patched-lib.conf && \ | ||
mkdir -p "/patched-lib" && \ | ||
PATCH_OUTPUT_DIR=/patched-lib /usr/local/bin/patch.sh && \ | ||
cd /patched-lib && \ | ||
for f in * ; do | ||
suffix="${f##*.so}" | ||
name="$(basename "$f" "$suffix")" | ||
[ -h "$name" ] || ln -sf "$f" "$name" | ||
[ -h "$name" ] || ln -sf "$f" "$name.1" | ||
done && \ | ||
ldconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-nvidia/patch/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bs4 | ||
lxml | ||
pystashlib | ||
requests | ||
stashapp-tools |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/command/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
# link download libraries | ||
if [[ ! -e "$/config/.stash/ffmpeg" ]]; then | ||
ln -s "/usr/local/bin" "/config/.stash/ffmpeg" | ||
fi | ||
if [[ ! -e "/config/.stash/ffprobe" ]]; then | ||
ln -s "/usr/local/bin/ffprobe" "/config/.stash/ffprobe" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-ffmpeg/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/command/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
# hotio migration | ||
|
||
# stashapp/stash migration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-migrate/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
find /etc/s6-overlay/s6-rc.d -name "run*" -exec chmod +x {} + |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
## check for existing requirements.txt | ||
if [[ ! -f /config/requirements.txt ]]; then | ||
cp /defaults/requirements.txt /config/requirements.txt | ||
fi | ||
|
||
## install and upgrade python requirements | ||
echo "Installing/upgrading python requirements..." | ||
pip3 install --upgrade --target "$PIP_INSTALL_TARGET" -r /config/requirements.txt | ||
export PYTHONPATH="$PYTHONPATH:$PIP_INSTALL_TARGET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-python-reqs/run |
Oops, something went wrong.