feat(agents): multi-arch checker and status page images on scratch
uptimesebi-checker and uptimesebi-statuspage for linux/amd64, arm64, arm/v7 and arm/v6, from a Raspberry Pi Zero to servers. tools/image assembles them from the cross-compiled binaries without Docker or emulation: one layer on an empty base with the binary, a data volume owned by the unprivileged user and a HEALTHCHECK running the new `checker health` / `statuspage health` commands. The binaries embed time zone data and fallback CA roots, so no base image ever needs updating. CI pushes them with the same channel tags as the main image; releases carry tarballs for all four platforms. Refs #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
e17e7aab41
commit
a9f94fc492
12 files changed
+638
-9
No files matched your search
@@ -132,11 +132,39 @@ jobs:
|
||||
run: npm ci --no-audit --no-fund && npm run build
|
||||
- name: Build binaries
|
||||
run: |
|
||||
for platform in linux/amd64 linux/arm64; do
|
||||
CGO_ENABLED=0 GOOS=${platform%/*} GOARCH=${platform#*/} \
|
||||
go build -trimpath -ldflags "-s -w" -o "dist/${platform%/*}_${platform#*/}/" ./cmd/...
|
||||
set -eu
|
||||
pkg=git.zb-server.de/ZB-Server/uptimesebi/internal/buildinfo
|
||||
case "$GITHUB_REF" in
|
||||
refs/tags/v*) version="$GITHUB_REF_NAME" ;;
|
||||
*) version="$(git log -1 --format=%cd --date=format:%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" ;;
|
||||
esac
|
||||
echo "VERSION=$version" >> "$GITHUB_ENV"
|
||||
for platform in linux/amd64 linux/arm64 linux/arm/v7 linux/arm/v6; do
|
||||
IFS=/ read -r os arch variant <<< "$platform"
|
||||
CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=${variant#v} go build -trimpath \
|
||||
-ldflags "-s -w -X $pkg.Version=$version -X $pkg.Commit=$(git rev-parse --short=12 HEAD)" \
|
||||
-o "dist/$(echo "$platform" | tr / _)/" ./cmd/...
|
||||
done
|
||||
ls -R dist
|
||||
ls -lR dist
|
||||
# Checker and status page images for every platform, assembled from the
|
||||
# binaries above without Docker; pushed like the main image.
|
||||
- name: Agent images
|
||||
env:
|
||||
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||
run: |
|
||||
set -eu
|
||||
host="${GITHUB_SERVER_URL#*://}"
|
||||
owner="$(printf '%s' "${GITHUB_REPOSITORY%/*}" | tr 'A-Z' 'a-z')"
|
||||
flags="-version $VERSION -commit $GITHUB_SHA -ref $GITHUB_REF -created $(git log -1 --format=%ct) -source $GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
||||
case "$GITHUB_SERVER_URL" in http://*) flags="$flags -insecure" ;; esac
|
||||
case "$GITHUB_REF" in
|
||||
refs/heads/main|refs/tags/v*)
|
||||
if [ -n "${PACKAGE_TOKEN:-}" ]; then flags="$flags -push"; else echo "PACKAGE_TOKEN is not set; building without pushing."; fi ;;
|
||||
esac
|
||||
export REGISTRY_USER="$GITHUB_ACTOR" REGISTRY_PASSWORD="${PACKAGE_TOKEN:-}"
|
||||
go run ./tools/image -name checker -repo "$host/$owner/uptimesebi-checker" -port 8081/tcp $flags
|
||||
go run ./tools/image -name statuspage -repo "$host/$owner/uptimesebi-statuspage" -port 8082/tcp \
|
||||
-env UPTIME_STATUSPAGE_CACHE_DIR=/var/lib/uptimesebi $flags
|
||||
|
||||
image:
|
||||
# Kaniko runs rootless from docker:cli, the same way as the other
|
||||
|
||||
Reference in new issue
Block a user