#!/bin/bash

# Configuration
REGISTRY="git.khoavo.myds.me"
IMAGE_NAME="vndangkhoa/apix"
TAG="latest"
FULL_IMAGE="$REGISTRY/$IMAGE_NAME:$TAG"

echo "=== Building Docker Image for Linux/AMD64 ==="
# We use --platform linux/amd64 because your NAS is likely amd64
docker build --platform linux/amd64 -t "$FULL_IMAGE" .

echo ""
echo "=== Logging in to Registry ($REGISTRY) ==="
echo "If prompted, enter your Forgejo Credentials"
docker login "$REGISTRY"

echo ""
echo "=== Pushing Image to Registry ==="
docker push "$FULL_IMAGE"

echo ""
echo "=== Done! ==="
echo "Image pushed to: $FULL_IMAGE"
echo "You can now use docker-compose.nas.yml on your Synology."
