#!/bin/bash # Build script for kami-spider combined base Docker image # This script creates a single comprehensive base image set -e # Configuration BASE_IMAGE_NAME="kami-spider-base" REGISTRY="${DOCKER_REGISTRY:-localhost:5000}" VERSION="${VERSION:-latest}" USE_PROXY="${USE_PROXY:-0}" echo "🏗️ Building kami-spider combined base Docker image..." echo "Registry: $REGISTRY" echo "Version: $VERSION" echo "Use Proxy: $USE_PROXY" echo # Build the combined base image (system + Python dependencies + Playwright) echo "📦 Building combined base image ($BASE_IMAGE_NAME)..." docker build \ --file Dockerfile.base \ --tag "$BASE_IMAGE_NAME:$VERSION" \ --tag "$BASE_IMAGE_NAME:latest" \ --build-arg USE_PROXY="$USE_PROXY" \ . # Tag for registry if specified if [ "$REGISTRY" != "localhost:5000" ]; then docker tag "$BASE_IMAGE_NAME:$VERSION" "$REGISTRY/$BASE_IMAGE_NAME:$VERSION" docker tag "$BASE_IMAGE_NAME:latest" "$REGISTRY/$BASE_IMAGE_NAME:latest" fi echo "✅ Combined base image built successfully!" # Push to registry if specified if [ "$REGISTRY" != "localhost:5000" ]; then echo "🚀 Pushing image to registry..." docker push "$REGISTRY/$BASE_IMAGE_NAME:$VERSION" docker push "$REGISTRY/$BASE_IMAGE_NAME:latest" echo "✅ Image pushed to registry successfully!" fi echo echo "🎉 Build completed successfully!" echo "Available images:" echo " - $BASE_IMAGE_NAME:$VERSION" echo " - $BASE_IMAGE_NAME:latest" # Display image size echo echo "📊 Image size:" docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" | grep "$BASE_IMAGE_NAME"