Remove Docker build from CI, add local push-docker.sh script
crane can't pull scratch in CI. Docker images are built locally on Mac where Docker is available, then pushed to Gitea registry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
46
scripts/push-docker.sh
Executable file
46
scripts/push-docker.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build and push Docker image to Gitea registry.
|
||||
# Run on a machine with Docker (your Mac).
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/push-docker.sh v0.1.0
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Load .env if present
|
||||
if [[ -f .env ]]; then
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
TAG="${1:?Usage: $0 <tag> (e.g. v0.1.0)}"
|
||||
REGISTRY="${GITEA_URL:-https://git.manko.yoga}"
|
||||
REGISTRY_HOST="${REGISTRY#https://}"
|
||||
REGISTRY_HOST="${REGISTRY_HOST#http://}"
|
||||
IMAGE="${REGISTRY_HOST}/manawenuz/btest-rs"
|
||||
|
||||
echo "=== Building Docker image for ${IMAGE}:${TAG} ==="
|
||||
|
||||
# Build the image
|
||||
docker build -t "${IMAGE}:${TAG}" -t "${IMAGE}:latest" .
|
||||
|
||||
echo ""
|
||||
echo "=== Pushing to ${REGISTRY_HOST} ==="
|
||||
|
||||
# Login if needed (uses GITEA_TOKEN from .env)
|
||||
if [[ -n "${GITEA_TOKEN:-}" ]]; then
|
||||
echo "${GITEA_TOKEN}" | docker login "${REGISTRY_HOST}" -u token --password-stdin
|
||||
fi
|
||||
|
||||
docker push "${IMAGE}:${TAG}"
|
||||
docker push "${IMAGE}:latest"
|
||||
|
||||
echo ""
|
||||
echo "Done! Images pushed:"
|
||||
echo " ${IMAGE}:${TAG}"
|
||||
echo " ${IMAGE}:latest"
|
||||
echo ""
|
||||
echo "Run with:"
|
||||
echo " docker run --rm -p 2000:2000 -p 2001-2100:2001-2100/udp ${IMAGE}:${TAG} -s -v"
|
||||
Reference in New Issue
Block a user