#!/bin/bash # Build and push event-uploader Docker images to Gitea container registry. # One-time: docker login 10.0.10.205:3000 (username: bert.hausmans, password: token or password). # Usage: ./scripts/docker-build-push.sh [VERSION] # VERSION defaults to "latest" (or git describe --tags --always if available). # Set PLATFORM=linux/arm64 if your Dockge server is ARM (e.g. Raspberry Pi). # Run from project root. set -e REGISTRY="${REGISTRY:-10.0.10.205:3000}" OWNER="${OWNER:-bert.hausmans}" cd "$(dirname "$0")/.." ROOT="$(pwd)" if [ -n "$1" ]; then VERSION="$1" else VERSION=$(git describe --tags --always 2>/dev/null || echo "latest") fi # Build for linux/amd64 so images run on typical Dockge servers (avoid "no matching manifest" on ARM-built images) PLATFORM="${PLATFORM:-linux/amd64}" echo "Building and pushing images with tag: $VERSION (platform: $PLATFORM)" echo "Registry: $REGISTRY, Owner: $OWNER" echo "" for name in api admin upload; do docker build --platform "$PLATFORM" -t "$REGISTRY/$OWNER/event-uploader-$name:$VERSION" "$ROOT/$name" docker push "$REGISTRY/$OWNER/event-uploader-$name:$VERSION" if [ "$VERSION" != "latest" ]; then docker tag "$REGISTRY/$OWNER/event-uploader-$name:$VERSION" "$REGISTRY/$OWNER/event-uploader-$name:latest" docker push "$REGISTRY/$OWNER/event-uploader-$name:latest" fi done echo "" echo "Done. Images pushed:" echo " $REGISTRY/$OWNER/event-uploader-api:$VERSION" echo " $REGISTRY/$OWNER/event-uploader-admin:$VERSION" echo " $REGISTRY/$OWNER/event-uploader-upload:$VERSION" if [ "$VERSION" != "latest" ]; then echo " (also tagged and pushed as :latest)" fi echo "On Dockge: set TAG=$VERSION (or TAG=latest) in stack .env, then Pull and Redeploy."