metube/DEPLOY.md

40 lines
1.4 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).
## Build & push (manual)
```sh
docker buildx build --platform linux/amd64 \
--build-arg VERSION=1.10 \
-t 192.168.2.212:3000/tigeren/metube:1.10 \
--push .
```
## Run
```sh
docker compose up -d --build --force-recreate
```