A static musl binary on an empty image, run as nobody, listening on 8080. scripts/publish-relay builds it from a clean, pushed commit of develop or main and pushes it to Gitea's registry, tagged with the commit and latest. The build context is an allowlist: never .env nor target/. RELAY_TRUSTED_PROXY also takes a network: Nginx Proxy Manager's address on the Docker network changes when it restarts. docs/service-relais.md gives the compose service, the env file, the NPM proxy host (no access log, Access List until #152), and how to update, change the key and check the restart and the per-address limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
931 B
Bash
Executable File
24 lines
931 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds the relay's image from a pushed commit of develop or main and pushes it to Gitea's
|
|
# registry, tagged with the commit and `latest` (docs/service-relais.md). Run from the repository
|
|
# root, after `docker login gitea.nessar.fr` once.
|
|
set -euo pipefail
|
|
|
|
image="${RELAY_IMAGE:-gitea.nessar.fr/nessar/arena-tracker-relay}"
|
|
|
|
if [[ -n "$(git status --porcelain)" ]]; then
|
|
echo "Le dépôt a des changements : l'image doit correspondre à un commit." >&2
|
|
exit 1
|
|
fi
|
|
git fetch -q origin
|
|
commit="$(git rev-parse --short HEAD)"
|
|
if ! git merge-base --is-ancestor HEAD origin/develop && ! git merge-base --is-ancestor HEAD origin/main; then
|
|
echo "Le commit $commit n'est ni sur origin/develop ni sur origin/main." >&2
|
|
exit 1
|
|
fi
|
|
|
|
docker build -f crates/relay/Dockerfile -t "$image:$commit" -t "$image:latest" .
|
|
docker push "$image:$commit"
|
|
docker push "$image:latest"
|
|
echo "Publiée : $image:$commit"
|