metube/DEPLOY.md

60 lines
2.2 KiB
Markdown

# Deployment
## Versioning rule
- The version number recorded in this file (i.e. checked into git) is the **current online version** — the version of the latest published Docker image.
- When any changes are made, the new Docker image version must **bump the minor number of the latest git version** (e.g. latest is `1.9` → new image is `1.10`).
- Whenever a new image is built and pushed, update the commands below in the same commit, so the checked-in version always matches the published image.
## Publishing (automated)
Use `publish.sh` — it reads the current version from this file, bumps the minor, updates this file, builds the image with the version build-arg and pushes it:
```sh
./publish.sh # bump minor of the current version (e.g. 1.10 -> 1.11)
./publish.sh 2.0 # publish an explicit version instead
```
## Cross-building
The dev machine is an Apple Silicon Mac (arm64) while the target server is
Ubuntu 22.04 x86_64, so images are cross-built with `docker buildx` for
`linux/amd64` and pushed straight to the registry (`--push`). Requires a
buildx builder with amd64 support (OrbStack / Docker Desktop provide one by
default, e.g. via QEMU emulation).
## Private yt-dlp build
Until upstream yt-dlp fixes the extractor bug, the image bakes a wheel built
from a local patched checkout instead of the pinned PyPI release:
- `./build-ytdlp.sh` builds the wheel from `~/Dev/github/yt-dlp` (override the
path with `YTDLP_REPO=...`) into `vendor/yt_dlp-*.whl`.
- The Dockerfile force-reinstalls that wheel over the version pinned in
`uv.lock` when the wheel is present; otherwise it silently falls back to the
pinned release.
- The wheel is git-ignored, so it is not committed.
- `publish.sh` runs `./build-ytdlp.sh` automatically and aborts if the local
checkout is missing.
See **`YTDLP_PRIVATE_BUILD.md`** for full details, including a step-by-step
guide to switching back to the official build once the upstream fix lands.
## Build & push (manual)
```sh
# Optional: stage the private yt-dlp wheel (see "Private yt-dlp build")
./build-ytdlp.sh
docker buildx build --platform linux/amd64 \
--build-arg VERSION=1.30 \
-t 192.168.2.212:3000/tigeren/metube:1.30 \
--push .
```
## Run
```sh
docker compose up -d --build --force-recreate
```