Migration to podman. Dev is OK, certificate problem with test
This commit is contained in:
@@ -3,19 +3,29 @@
|
||||
# Exit on any error
|
||||
set -e
|
||||
|
||||
source ./docker_env_switch.sh dev
|
||||
source ./podman_env_switch.sh dev
|
||||
|
||||
# Load environment variables
|
||||
source .env
|
||||
|
||||
# Docker registry
|
||||
REGISTRY="josakola"
|
||||
# Check if podman is available
|
||||
if ! command -v podman &> /dev/null; then
|
||||
echo "Error: podman not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using container runtime: podman"
|
||||
|
||||
# Local registry
|
||||
REGISTRY="registry.ask-eve-ai-local.com"
|
||||
# Account prefix voor consistency met Docker Hub
|
||||
ACCOUNT="josakola"
|
||||
|
||||
# Tag (you might want to use a version or git commit hash)
|
||||
TAG="latest"
|
||||
|
||||
# Platforms to build for
|
||||
PLATFORMS="linux/amd64,linux/arm64"
|
||||
# Single platform - AMD64 only for simplicity
|
||||
PLATFORM="linux/amd64"
|
||||
|
||||
# Default action
|
||||
ACTION="both"
|
||||
@@ -28,13 +38,14 @@ DEBUG=""
|
||||
# Function to display usage information
|
||||
usage() {
|
||||
echo "Usage: $0 [-b|-p] [--no-cache] [--progress=plain] [--debug] [service1 service2 ...]"
|
||||
echo " -b: Build only (for current platform)"
|
||||
echo " -p: Push only (multi-platform)"
|
||||
echo " -b: Build only"
|
||||
echo " -p: Push only"
|
||||
echo " --no-cache: Perform a clean build without using cache"
|
||||
echo " --progress=plain: Show detailed progress of the build"
|
||||
echo " --debug: Enable debug mode for the build"
|
||||
echo " If no option is provided, both build and push will be performed."
|
||||
echo " If no services are specified, all eveai_ services and nginx will be processed."
|
||||
echo " All images are built for AMD64 platform (compatible with both x86_64 and Apple Silicon via emulation)."
|
||||
}
|
||||
|
||||
# Parse command-line options
|
||||
@@ -92,47 +103,57 @@ process_service() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Construct image names
|
||||
LOCAL_IMAGE_NAME="$ACCOUNT/$SERVICE:$TAG"
|
||||
REGISTRY_IMAGE_NAME="$REGISTRY/$ACCOUNT/$SERVICE:$TAG"
|
||||
|
||||
echo "Building for platform: $PLATFORM"
|
||||
echo "Local tag: $LOCAL_IMAGE_NAME"
|
||||
echo "Registry tag: $REGISTRY_IMAGE_NAME"
|
||||
|
||||
# Build and/or push based on ACTION
|
||||
if [ "$ACTION" = "build" ]; then
|
||||
echo "Building $SERVICE for current platform..."
|
||||
docker build \
|
||||
echo "Building $SERVICE for $PLATFORM..."
|
||||
podman build \
|
||||
--platform "$PLATFORM" \
|
||||
$NO_CACHE \
|
||||
$PROGRESS \
|
||||
$DEBUG \
|
||||
-t "$REGISTRY/$SERVICE:$TAG" \
|
||||
-f "$CONTEXT/$DOCKERFILE" \
|
||||
"$CONTEXT"
|
||||
elif [ "$ACTION" = "push" ]; then
|
||||
echo "Building and pushing $SERVICE for multiple platforms..."
|
||||
docker buildx build \
|
||||
$NO_CACHE \
|
||||
$PROGRESS \
|
||||
$DEBUG \
|
||||
--platform "$PLATFORMS" \
|
||||
-t "$REGISTRY/$SERVICE:$TAG" \
|
||||
-f "$CONTEXT/$DOCKERFILE" \
|
||||
"$CONTEXT" \
|
||||
--push
|
||||
else
|
||||
echo "Building $SERVICE for current platform..."
|
||||
docker build \
|
||||
$NO_CACHE \
|
||||
$PROGRESS \
|
||||
$DEBUG \
|
||||
-t "$REGISTRY/$SERVICE:$TAG" \
|
||||
-t "$LOCAL_IMAGE_NAME" \
|
||||
-t "$REGISTRY_IMAGE_NAME" \
|
||||
-f "$CONTEXT/$DOCKERFILE" \
|
||||
"$CONTEXT"
|
||||
|
||||
echo "Building and pushing $SERVICE for multiple platforms..."
|
||||
docker buildx build \
|
||||
elif [ "$ACTION" = "push" ]; then
|
||||
echo "Building and pushing $SERVICE for $PLATFORM..."
|
||||
podman build \
|
||||
--platform "$PLATFORM" \
|
||||
$NO_CACHE \
|
||||
$PROGRESS \
|
||||
$DEBUG \
|
||||
--platform "$PLATFORMS" \
|
||||
-t "$REGISTRY/$SERVICE:$TAG" \
|
||||
-t "$LOCAL_IMAGE_NAME" \
|
||||
-t "$REGISTRY_IMAGE_NAME" \
|
||||
-f "$CONTEXT/$DOCKERFILE" \
|
||||
"$CONTEXT" \
|
||||
--push
|
||||
"$CONTEXT"
|
||||
|
||||
echo "Pushing $SERVICE to registry..."
|
||||
podman push "$REGISTRY_IMAGE_NAME"
|
||||
|
||||
else
|
||||
# Both build and push
|
||||
echo "Building $SERVICE for $PLATFORM..."
|
||||
podman build \
|
||||
--platform "$PLATFORM" \
|
||||
$NO_CACHE \
|
||||
$PROGRESS \
|
||||
$DEBUG \
|
||||
-t "$LOCAL_IMAGE_NAME" \
|
||||
-t "$REGISTRY_IMAGE_NAME" \
|
||||
-f "$CONTEXT/$DOCKERFILE" \
|
||||
"$CONTEXT"
|
||||
|
||||
echo "Pushing $SERVICE to registry..."
|
||||
podman push "$REGISTRY_IMAGE_NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -146,31 +167,25 @@ else
|
||||
SERVICES=("$@")
|
||||
fi
|
||||
|
||||
# Check if eveai_builder exists, if not create it
|
||||
if ! docker buildx inspect eveai_builder > /dev/null 2>&1; then
|
||||
echo "Creating eveai_builder..."
|
||||
docker buildx create --name eveai_builder
|
||||
fi
|
||||
|
||||
# Use eveai_builder
|
||||
echo "Using eveai_builder..."
|
||||
docker buildx use eveai_builder
|
||||
echo "Using simplified AMD64-only approach for maximum compatibility..."
|
||||
echo "Images will be tagged as: $REGISTRY/$ACCOUNT/[service]:$TAG"
|
||||
|
||||
# Loop through services
|
||||
for SERVICE in "${SERVICES[@]}"; do
|
||||
if [[ "$SERVICE" == "nginx" ]]; then
|
||||
./copy_specialist_svgs.sh ../config ../nginx/static/assets
|
||||
./copy_specialist_svgs.sh ../config ../nginx/static/assets 2>/dev/null || echo "Warning: copy_specialist_svgs.sh not found or failed"
|
||||
fi
|
||||
if [[ "$SERVICE" == "nginx" || "$SERVICE" == eveai_* || "$SERVICE" == "flower" || "$SERVICE" == "prometheus" || "$SERVICE" == "grafana" ]]; then
|
||||
if process_service "$SERVICE"; then
|
||||
echo "Successfully processed $SERVICE"
|
||||
echo "✅ Successfully processed $SERVICE"
|
||||
else
|
||||
echo "Failed to process $SERVICE"
|
||||
echo "❌ Failed to process $SERVICE"
|
||||
fi
|
||||
else
|
||||
echo "Skipping $SERVICE as it's not nginx, flower, prometheus, grafana or doesn't start with eveai_"
|
||||
echo "⏭️ Skipping $SERVICE as it's not nginx, flower, prometheus, grafana or doesn't start with eveai_"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\033[35mAll specified services processed.\033[0m"
|
||||
echo -e "\033[35mFinished at $(date +"%d/%m/%Y %H:%M:%S")\033[0m"
|
||||
echo -e "\033[32m✅ All specified services processed successfully!\033[0m"
|
||||
echo -e "\033[32m📦 Images are available locally and in registry\033[0m"
|
||||
echo -e "\033[32m🕐 Finished at $(date +"%d/%m/%Y %H:%M:%S")\033[0m"
|
||||
Reference in New Issue
Block a user