Files
J621/deploy/push_frontend.sh
T
JakeBreath d9c1e9e521
CI / Backend tests (push) Successful in 12m54s
CI / Frontend build & lint (push) Failing after 4m59s
Add CI and manual image publishing workflows
- .gitea/workflows/ci.yml: on every push/PR, run Django checks + the full
  backend suite against MariaDB/Redis services and the frontend
  lint/type-check/build. Runs on the nitro-ci runner (ubuntu-latest).
- .gitea/workflows/publish.yml: manual dispatch; multi-arch build+push of
  both images as :latest and :<short-sha> with GIT_HASH baked in.
- push_*.sh: non-interactive registry login for CI (REGISTRY_USER/
  REGISTRY_TOKEN) and a PLATFORMS override.
2026-09-22 22:32:37 -05:00

43 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Build and push the J621 frontend image (amd64 + arm64) to the private Gitea
# registry as :latest and :<commit-sha>.
#
# Usage: ./push_frontend.sh [commit-sha]
set -euo pipefail
cd "$(dirname "$0")/.."
REGISTRY="gitea.rainbow-herring.ts.net/jakebreath/j621-frontend"
REGISTRY_HOST="$(printf '%s' "$REGISTRY" | cut -d/ -f1)"
SHA="${1:-$(git rev-parse --short HEAD)}"
BUILDER=multiarch
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
echo "==> Logging in to $REGISTRY_HOST ..."
if [ -n "${REGISTRY_USER:-}" ] && [ -n "${REGISTRY_TOKEN:-}" ]; then
# Non-interactive login for CI (workflow passes GITHUB_TOKEN).
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" \
-u "$REGISTRY_USER" --password-stdin
else
docker login "$REGISTRY_HOST"
fi
if ! docker buildx inspect "$BUILDER" >/dev/null 2>&1; then
echo "==> Creating buildx builder '$BUILDER' ..."
docker buildx create --name "$BUILDER" --driver docker-container \
--platform "$PLATFORMS" --bootstrap
else
docker buildx inspect --bootstrap "$BUILDER" >/dev/null
fi
echo "==> Building + pushing $PLATFORMS -> $REGISTRY:{latest,$SHA} ..."
docker buildx build --builder "$BUILDER" --push \
--platform "$PLATFORMS" \
--build-arg "GIT_HASH=$SHA" \
-f deploy/J621-Frontend \
-t "$REGISTRY:latest" \
-t "$REGISTRY:$SHA" \
.
echo "==> Done. On the deploy host:"
echo " docker login $REGISTRY_HOST && docker compose pull && docker compose up -d"