#!/bin/bash
# Build custom base images with dependencies pre-installed
# Run this on a machine with internet access, then push to Harbor

set -e

HARBOR_REGISTRY="harbor.dvirlabs.com"
HARBOR_PROJECT="base-images"

echo "🏗️  Building custom base images for air-gapped cluster..."
echo "Registry: $HARBOR_REGISTRY"
echo "Project: $HARBOR_PROJECT"
echo ""

# Login to Harbor
echo "Please login to Harbor:"
docker login $HARBOR_REGISTRY

echo ""
echo "📦 Building Python base image with dev tools..."
echo ""

# Build Python dev image
cd base-images/python-3.11-slim-dev
docker build -t $HARBOR_REGISTRY/$HARBOR_PROJECT/python:3.11-slim-dev .
cd ../..

echo "✅ Built: python:3.11-slim-dev"
echo ""

# Push to Harbor
echo "🚀 Pushing to Harbor..."
docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/python:3.11-slim-dev

echo ""
echo "🎉 Custom base image pushed successfully!"
echo ""
echo "To use this image, update your Dockerfile:"
echo "  FROM $HARBOR_REGISTRY/$HARBOR_PROJECT/python:3.11-slim-dev"
echo ""
