Ctrl K
ComunidadGuías…

docker-compose.portainer.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# ============================================================================
# Shrinkerr — production / Portainer deploy
#
# This is the deployment-ready compose file. It pulls a prebuilt `shrinkerr:latest`
# image instead of building from source. Use this one in Portainer, or on any
# host where you just want to pull + run without a git checkout.
#
# Quick start (Portainer):
#   1. Stacks → Add stack → paste this file.
#   2. Edit the `volumes:` paths (marked "CHANGE ME") to match your host.
#   3. Deploy. The UI is on port 6680: http://<host>:6680
#
# Quick start (CLI):
#   docker compose -f docker-compose.portainer.yml pull
#   docker compose -f docker-compose.portainer.yml up -d
#
# Upgrading:
#   docker compose -f docker-compose.portainer.yml pull
#   docker compose -f docker-compose.portainer.yml up -d
#   (Your data in /app/data is preserved across upgrades.)
# ============================================================================

services:
  shrinkerr:
    # ----- Image tag — pick one -------------------------------------------
    # Four tags are published, split into two lineages:
    #
    # Portable (multi-arch: linux/amd64 + linux/arm64, CPU encoding only)
    # Works on ANY host — Linux server, Mac, Windows, Raspberry Pi, ARM cloud:
    #   shrinkerr:latest      — ffmpeg n7.1   (stable, DEFAULT)
    #   shrinkerr:edge        — ffmpeg master (bleeding edge)
    #
    # NVENC (linux/amd64 only, CUDA base, hardware encoding on NVIDIA GPUs)
    # Requires an NVIDIA GPU + the NVIDIA Container Toolkit on the host:
    #   shrinkerr:nvenc       — ffmpeg n7.1   (NVIDIA driver 525.60.13+)
    #   shrinkerr:edge-nvenc  — ffmpeg master (NVIDIA driver 570.00+)
    #
    # Pin to a specific version (e.g. shrinkerr:v0.9.0-nvenc) for deterministic
    # upgrades; the floating tags above track their branches.
    image: shrinkerr:latest
    container_name: shrinkerr

    # --- Web UI + API port ---
    # Left side = port on your host. Change if 6680 is already in use.
    # Right side = port inside the container (do not change).
    # e.g. "8080:6680" → visit http://<host>:8080
    ports:
      - "6680:6680"

    volumes:
      # --- Required: persistent app data ---
      # SQLite database, logs, encoding history, backups. Back this up.
      # CHANGE ME: set the left side to a real path on your host.
      # Linux/Mac: - /srv/shrinkerr/data:/app/data
      # Windows:   - C:\ProgramData\shrinkerr\data:/app/data
      - /srv/shrinkerr/data:/app/data

      # --- Required: your media library ---
      # Must be READ + WRITE — Shrinkerr overwrites originals in place
      # (unless you disable "trash after conversion" in Settings).
      # `rslave` propagation makes it so Shrinkerr sees any new mounts the
      # host attaches *under* this path after the container starts — useful
      # if you have a NAS share that auto-mounts on boot.
      # CHANGE ME: set `source:` to the root of your media library.
      # Linux/Mac: source: /srv/media  OR  /mnt/nas/media
      # Windows:   source: E:\media
      - type: bind
        source: /srv/media
        target: /media
        bind:
          propagation: rslave

      # --- Optional: NZBGet / SABnzbd completed-downloads folders ---
      # Only needed if you use the NZBGet / SABnzbd post-processing scripts
      # (see Settings → Automation). These are the folders your downloader
      # drops files into when a download finishes. Shrinkerr needs read+write
      # so it can hand files off to Sonarr/Radarr after processing.
      # Delete these two lines if you don't use nzb/sab.
      # CHANGE ME: adjust paths to match your downloader's "completed" folders.
      # - /srv/downloads/completed/TV:/downloads/tv:rw
      # - /srv/downloads/completed/Movies:/downloads/movies:rw

    environment:
      # The app's defaults for DB path (/app/data/shrinkerr.db) and media
      # root (/media) already match the volume mounts above, so nothing
      # else needs to go here. Override with SHRINKERR_DB_PATH or
      # SHRINKERR_MEDIA_ROOT if you really need to point elsewhere.

      # --- File ownership for created/modified files ---
      # Files Shrinkerr writes will be owned by this UID/GID on the host.
      # Usually matches your regular user (run `id` on the host to check).
      # Leaving both at 1000 is safe for almost everyone.
      # NOTE: these are advisory — current Dockerfile runs as root regardless.
      # Safe to keep for forward-compat, but don't rely on them for security.
      - PGID=1000
      - PUID=1000

      # If you're using the :nvenc / :edge-nvenc image, also uncomment:
      # - NVIDIA_VISIBLE_DEVICES=all

    restart: unless-stopped

    # =======================================================================
    # GPU passthrough — ONLY needed for the :nvenc or :edge-nvenc image.
    # The portable :latest / :edge image has no CUDA runtime; this block
    # does nothing for it.
    #
    # To switch to NVENC:
    #   1. Change the `image:` line above to shrinkerr:nvenc (or :edge-nvenc).
    #   2. Uncomment `- NVIDIA_VISIBLE_DEVICES=all` under environment above.
    #   3. Uncomment the GPU block below. Two scenarios:
    #        Linux (with NVIDIA Container Toolkit):
    #            uncomment BOTH `runtime: nvidia` AND `deploy:`
    #        Windows (Docker Desktop in WSL2 mode):
    #            uncomment ONLY `deploy:` — Docker Desktop does not register
    #            a `nvidia` runtime name, so the `runtime:` line errors out
    #            there. Windows 10 21H2+ / Windows 11 with a recent NVIDIA
    #            Windows driver; Docker Desktop handles the rest.
    #        macOS: not supported — use the portable :latest image.
    #
    # Why both on Linux? `deploy.resources.reservations.devices` is the
    # portable compose spec and *should* be enough on a modern Docker +
    # Compose V2. In practice, on many Linux installs (especially when the
    # NVIDIA Container Toolkit is installed but `nvidia` isn't configured
    # as Docker's default runtime) the `deploy:` block alone silently fails
    # to attach the GPU. Adding `runtime: nvidia` makes the request
    # unambiguous — the two together are belt-and-suspenders reliable.
    #
    # DRIVER VERSION:
    #   :nvenc        → ffmpeg n7.1   → NVIDIA driver 525.60.13+
    #   :edge-nvenc   → ffmpeg master → NVIDIA driver 570.00+
    # If the driver is too old, the runtime test encode fails and the
    # Monitor page tells you exactly what to upgrade to.
    # =======================================================================
    # runtime: nvidia
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: all
    #           capabilities: [gpu, compute, video, utility]
    #           # `utility` is what enables nvidia-smi / NVML, which
    #           # drives the GPU panels in the Monitor page. Leaving
    #           # it off makes encodes work but hides GPU stats.

  # ==========================================================================
  # Optional: remote worker node
  #
  # Uncomment to add a second container (on this host or another) that picks
  # up jobs from the main server above. Useful for offloading CPU encoding
  # to a beefier machine, or for mixing x86/NVENC + ARM/CPU workers.
  #
  # Setup:
  #   1. In the main Shrinkerr UI: Settings → Nodes → create a worker API key.
  #   2. Paste that key into API_KEY below.
  #   3. Set SERVER_URL to how the worker reaches the server:
  #        - Same docker network / same stack: http://shrinkerr:6680
  #        - Different host:                   http://<server-lan-ip>:6680
  #   4. Deploy the stack. The worker appears on the Nodes page within ~30s.
  #
  # Image choice for the worker mirrors the main service:
  #   shrinkerr:latest / :edge       → portable, any arch, CPU-only
  #   shrinkerr:nvenc / :edge-nvenc  → linux/amd64, CUDA+NVENC, GPU host
  # ==========================================================================
  # shrinkerr-worker:
  #   image: shrinkerr:latest            # or shrinkerr:nvenc for a GPU worker
  #   container_name: shrinkerr-worker
  #   environment:
  #     - SHRINKERR_MODE=worker          # switches container to worker mode (no UI, no server)
  #     - SERVER_URL=http://shrinkerr:6680
  #     - API_KEY=REPLACE_WITH_WORKER_KEY
  #     - WORKER_NAME=gaming-pc          # shown on the Nodes page
  #     - CAPABILITIES=nvenc,libx265     # advertise what this node can do. Valid: nvenc, libx265
  #     # If the worker mounts media at a different path than the server does,
  #     # map the paths here (JSON list of [server_path, worker_path] pairs):
  #     # - PATH_MAPPINGS=[["/media","/mnt/nas"]]
  #     # Only needed for the NVENC worker image:
  #     # - NVIDIA_VISIBLE_DEVICES=all
  #     # Timing (all optional; defaults shown):
  #     # - POLL_INTERVAL=5              # seconds between job polls
  #     # - HEARTBEAT_INTERVAL=30        # seconds between "I'm alive" pings
  #     # - METRICS_INTERVAL=5           # seconds between CPU/GPU metric reports
  #   volumes:
  #     # Must see the media at the same path the server uses (or use PATH_MAPPINGS).
  #     - /srv/media:/media
  #   restart: unless-stopped
  #   # For the :nvenc worker image, uncomment the GPU block below. Same
  #   # platform rules as the main service above: Linux needs BOTH
  #   # `runtime: nvidia` and `deploy:`; Windows/Docker Desktop needs only
  #   # `deploy:`; macOS is not supported.
  #   # runtime: nvidia
  #   # deploy:
  #   #   resources:
  #   #     reservations:
  #   #       devices:
  #   #         - driver: nvidia
  #   #           count: all
  #   #           capabilities: [gpu, video]