Skip to content

Commit d9e8e4a

Browse files
feat: add stash (#915)
Co-authored-by: Devin Buhl <[email protected]> Co-authored-by: Devin Buhl <[email protected]>
1 parent b4f4235 commit d9e8e4a

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

apps/stash/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM docker.io/library/python:3.13-alpine3.22
4+
ARG TARGETARCH
5+
ARG STASHARCH=${TARGETARCH/arm64/-arm64v8}
6+
ARG STASHARCH=${STASHARCH/amd64/}
7+
ARG VERSION
8+
9+
ENV \
10+
CRYPTOGRAPHY_DONT_BUILD_RUST=1 \
11+
PIP_BREAK_SYSTEM_PACKAGES=1 \
12+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
13+
PIP_NO_CACHE_DIR=1 \
14+
PIP_ROOT_USER_ACTION=ignore \
15+
PYTHONDONTWRITEBYTECODE=1 \
16+
PYTHONUNBUFFERED=1 \
17+
UV_NO_CACHE=true \
18+
UV_SYSTEM_PYTHON=true \
19+
UV_EXTRA_INDEX_URL="https://wheel-index.linuxserver.io/alpine-3.22/"
20+
21+
USER root
22+
WORKDIR /app
23+
24+
RUN \
25+
apk add --no-cache \
26+
bash \
27+
ca-certificates \
28+
catatonit \
29+
coreutils \
30+
curl \
31+
ffmpeg \
32+
jq \
33+
nano \
34+
tzdata
35+
36+
RUN \
37+
curl -fsSL -o /app/stash https://github.com/stashapp/stash/releases/download/${VERSION}/stash-linux${STASHARCH} \
38+
&& pip install uv \
39+
&& chown -R root:root /app && chmod -R 755 /app \
40+
&& rm -rf /root/.cache /root/.cargo /tmp/*
41+
42+
COPY . /
43+
44+
USER nobody:nogroup
45+
WORKDIR /config
46+
VOLUME ["/config"]
47+
48+
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

apps/stash/container_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"testing"
6+
7+
"github.com/home-operations/containers/testhelpers"
8+
)
9+
10+
func Test(t *testing.T) {
11+
ctx := context.Background()
12+
image := testhelpers.GetTestImage("ghcr.io/home-operations/stash:rolling")
13+
testhelpers.TestHTTPEndpoint(t, ctx, image, testhelpers.HTTPTestConfig{Port: "9999"}, nil)
14+
}

apps/stash/docker-bake.hcl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
target "docker-metadata-action" {}
2+
3+
variable "APP" {
4+
default = "stash"
5+
}
6+
7+
variable "VERSION" {
8+
// renovate: datasource=github-releases depName=stashapp/stash
9+
default = "v0.28.1"
10+
}
11+
12+
variable "SOURCE" {
13+
default = "https://github.com/stashapp/stash"
14+
}
15+
16+
group "default" {
17+
targets = ["image-local"]
18+
}
19+
20+
target "image" {
21+
inherits = ["docker-metadata-action"]
22+
args = {
23+
VERSION = "${VERSION}"
24+
}
25+
labels = {
26+
"org.opencontainers.image.source" = "${SOURCE}"
27+
}
28+
}
29+
30+
target "image-local" {
31+
inherits = ["image"]
32+
output = ["type=docker"]
33+
tags = ["${APP}:${VERSION}"]
34+
}
35+
36+
target "image-all" {
37+
inherits = ["image"]
38+
platforms = [
39+
"linux/amd64",
40+
"linux/arm64"
41+
]
42+
}

apps/stash/entrypoint.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
export USER="stash"
4+
5+
dirs=(
6+
/config/plugins
7+
/config/scrapers
8+
)
9+
10+
for dir in "${dirs[@]}"; do
11+
find "${dir}" -type f -name "requirements.txt" | while read -r reqfile; do
12+
target_dir="$(dirname "$reqfile")"
13+
echo "Installing Python requirements from: ${reqfile}"
14+
uv pip install --requirement "${reqfile}" --target "${target_dir}"
15+
done
16+
done
17+
18+
exec /app/stash "$@"

0 commit comments

Comments
 (0)