@echo off
REM Build and push Alpine with git and yq for CI/CD

set HARBOR_REGISTRY=harbor.dvirlabs.com
set HARBOR_PROJECT=base-images
set IMAGE_NAME=alpine-git-yq
set TAG=3.19

echo.
echo 🏗️  Building Alpine image with git and yq...
echo Registry: %HARBOR_REGISTRY%
echo Image: %HARBOR_PROJECT%/%IMAGE_NAME%:%TAG%
echo.

REM Build the image
cd base-images\alpine-git-yq
docker build -t %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:%TAG% .
docker tag %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:%TAG% %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:latest
cd ..\..

echo.
echo ✅ Image built successfully!
echo.

REM Login to Harbor
echo Please login to Harbor:
docker login %HARBOR_REGISTRY%

REM Push to Harbor
echo.
echo 🚀 Pushing to Harbor...
docker push %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:%TAG%
docker push %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:latest

echo.
echo 🎉 Alpine CI image pushed successfully!
echo.
echo Image: %HARBOR_REGISTRY%/%HARBOR_PROJECT%/%IMAGE_NAME%:%TAG%
echo.
pause
