From d8e0e41f226678eb2183e78ef97c2e195e4a2c1e Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 3 Mar 2026 16:59:49 +0000 Subject: [PATCH] feat: self-hosted Docker image with Gitea Actions and Unraid docs - Dockerfile: replace s6overlay with multi-stage build (golang:1.22-alpine builder + alpine:3.19 runtime), compiles from source, no goreleaser needed - docker/entrypoint.sh: PUID/PGID support via su-exec - .gitea/workflows/docker.yml: auto-build and push to Gitea container registry on every master commit (linux/amd64 + linux/arm64) - README: add tmdb api_key docs, update Docker section to point to forge.dilain.com registry, add Unraid setup section Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/docker.yml | 39 +++++++++++++++ README.md | 98 +++++++++++++++++++++++-------------- docker/Dockerfile | 34 ++++++++----- docker/entrypoint.sh | 15 ++++++ 4 files changed, 138 insertions(+), 48 deletions(-) create mode 100644 .gitea/workflows/docker.yml create mode 100644 docker/entrypoint.sh diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..fbf1990 --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,39 @@ +name: Docker + +on: + push: + branches: + - master + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: qemu + uses: docker/setup-qemu-action@v2 + + - name: buildx + uses: docker/setup-buildx-action@v2 + + - name: login + uses: docker/login-action@v2 + with: + registry: forge.dilain.com + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + forge.dilain.com/laurent/nabarr:master + forge.dilain.com/laurent/nabarr:latest diff --git a/README.md b/README.md index 15e0752..396b177 100644 --- a/README.md +++ b/README.md @@ -55,26 +55,30 @@ media: api_key: omdb-api-key tvdb: api_key: tvdb-legacy-api-key + tmdb: + api_key: tmdb-api-key ``` An omdb `api_key` can be provided which will be used to supplement trakt data with additional information such as: -- Metascore +- Metascore - RottenTomatoes -- ImdbRating -- ImdbVotes -- Language +- ImdbRating +- ImdbVotes +- Language - Country An tvdb `api_key` can be provided which will be used to supplement trakt data with additional information such as: -- Runtime -- Language -- Genre -- AirsDayOfWeek -- SiteRating +- Runtime +- Language +- Genre +- AirsDayOfWeek +- SiteRating - SiteRatingCount +A tmdb `api_key` can be provided to enable automatic enrichment of RSS feed items that carry no media ID. When an item has no tvdb/imdb/tmdb ID, Nabarr will parse the release title, extract a clean title and year, then search TMDB to resolve a TMDB ID before processing. Get a free API key at [themoviedb.org](https://www.themoviedb.org/settings/api). + ### PVR @@ -139,11 +143,11 @@ rss: - sonarr ``` -In order for Nabarr to be-able to process items in these feeds, a tvdb and/or imdb id must be present in the feed items. +In order for Nabarr to process items in these feeds, a tvdb, imdb or tmdb id must be present in the feed items. If no ID is found but a `tmdb.api_key` is configured, Nabarr will attempt to resolve the ID automatically from the release title. If there is a tvdb id present, it is assumed that the feed item relates to a TV Series and thus, the item will propagate to any Sonarr PVR specified. -If there is a imdb id present, it is assumed that the feed item relates to a Movie and thus, the item will propagate to any Radarr PVR specified. +If there is a imdb or tmdb id present, it is assumed that the feed item relates to a Movie and thus, the item will propagate to any Radarr PVR specified. ### Full config file @@ -224,12 +228,18 @@ rss: ### Docker -Nabarr's Docker image provides various versions that are available via tags. The `latest` tag usually provides the latest stable version. Others are considered under development and caution must be exercised when using them. +The Docker image is built automatically from this repository and pushed to the Gitea container registry on every commit to `master`. | Tag | Description | | :----: | --- | -| latest | Latest stable version from a tagged GitHub release | -| master | Most recent GitHub master commit | +| `latest` | Most recent master commit | +| `master` | Most recent master commit | + +#### Build locale + +```bash +docker build -t nabarr -f docker/Dockerfile . +``` #### Usage @@ -237,41 +247,57 @@ Nabarr's Docker image provides various versions that are available via tags. The docker run \ --name=nabarr \ -e "PUID=1000" \ - -e "PGID=1001" \ + -e "PGID=1000" \ -v "/opt/nabarr:/config" \ --restart=unless-stopped \ - -d cloudb0x/nabarr:latest + -d forge.dilain.com/laurent/nabarr:latest ``` #### Parameters -Nabarr's Docker image supports the following parameters. - | Parameter | Function | | :----: | --- | -| `-e PUID=1000` | The UserID to run the Nabarr binary as | -| `-e PGID=1000` | The GroupID to run the Nabarr binary as | -| `-e APP_VERBOSITY=0` | The Nabarr logging verbosity level to use. (0 = info, 1 = debug, 2 = trace) | -| `-v /config` | Nabarr's config | +| `-e PUID=1000` | UserID to run Nabarr as | +| `-e PGID=1000` | GroupID to run Nabarr as | +| `-e APP_VERBOSITY=0` | Log verbosity (0 = info, 1 = debug, 2 = trace) | +| `-v /config` | Config, cache and log directory | -#### Cloudbox +### Unraid -The following Docker setup should work for many Cloudbox users. +#### Ajouter le registre privé -**WARNING: You still need to configure the `config.yml` file!** +Dans **Settings → Docker → Registry URL**, ajouter : -```bash -docker run \ - --name=nabarr \ - -e "PUID=1000" \ - -e "PGID=1001" \ - -v "/opt/nabarr:/config" \ - --label="com.github.cloudbox.cloudbox_managed=true" \ - --network=cloudbox \ - --network-alias=nabarr \ - --restart=unless-stopped \ - -d cloudb0x/nabarr:latest ``` +https://forge.dilain.com +``` + +#### Ajouter le conteneur manuellement + +Dans l'onglet **Docker**, cliquer sur **Add Container** et renseigner : + +| Champ | Valeur | +| --- | --- | +| Name | `nabarr` | +| Repository | `forge.dilain.com/laurent/nabarr:latest` | +| Network Type | `bridge` | +| Restart | `unless-stopped` | + +Ajouter les variables d'environnement : + +| Variable | Valeur par défaut | Description | +| --- | --- | --- | +| `PUID` | `99` | UserID (nobody sur Unraid) | +| `PGID` | `100` | GroupID (users sur Unraid) | +| `APP_VERBOSITY` | `0` | Niveau de log (0/1/2) | + +Ajouter le volume : + +| Container path | Host path | +| --- | --- | +| `/config` | `/mnt/user/appdata/nabarr` | + +> **Note :** Placer le fichier `config.yml` dans `/mnt/user/appdata/nabarr/` avant de démarrer le conteneur. ## Donate diff --git a/docker/Dockerfile b/docker/Dockerfile index fc125d3..4f227c7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,21 +1,31 @@ -FROM sc4h/alpine-s6overlay:v2-3.15 +# Build stage +FROM golang:1.22-alpine AS builder -ARG TARGETOS -ARG TARGETARCH -ARG TARGETVARIANT +WORKDIR /build +COPY . . + +RUN CGO_ENABLED=0 go build \ + -ldflags="-s -w" \ + -trimpath \ + -o nabarr \ + ./cmd/nabarr + +# Runtime stage +FROM alpine:3.19 + +RUN apk add --no-cache ca-certificates tzdata su-exec + +COPY --from=builder /build/nabarr /app/nabarr +COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh ENV \ - PATH="/app/nabarr:${PATH}" \ APP_CONFIG="/config/config.yml" \ APP_CACHE="/config/cache" \ APP_LOG="/config/activity.log" \ APP_VERBOSITY="0" -# Binary -COPY ["dist/nabarr_${TARGETOS}_${TARGETARCH}${TARGETVARIANT:+_7}/nabarr", "/app/nabarr/nabarr"] - -# Add root files -COPY ["docker/run", "/etc/services.d/nabarr/run"] - -# Volume VOLUME ["/config"] + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["run"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..87086b4 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +PUID=${PUID:-1000} +PGID=${PGID:-1000} + +if [ "$(id -u)" = "0" ]; then + addgroup -g "$PGID" nabarr 2>/dev/null || true + adduser -u "$PUID" -G nabarr -s /bin/sh -D nabarr 2>/dev/null || true + mkdir -p /config + chown -R nabarr:nabarr /config + exec su-exec nabarr /app/nabarr "$@" +else + exec /app/nabarr "$@" +fi