#!/bin/bash # Directory containing the Docker images IMAGE_DIR="docker/images" # Load all Docker images from the tar.xz files in the IMAGE_DIR echo "Loading Docker images from $IMAGE_DIR..." for image_file in "$IMAGE_DIR"/*.tar.xz; do if [ -f "$image_file" ]; then echo "Loading Docker image from $image_file..." docker load -i "$image_file" # Check if the image loading was successful if [ $? -ne 0 ]; then echo "Error occurred while loading Docker image from $image_file" exit 1 fi else echo "No Docker image tar.xz files found in $IMAGE_DIR." fi done # Execute docker compose echo "Running docker compose..." docker compose -f "docker/compose.yml" up -d # Check if the operation was successful if [ $? -eq 0 ]; then echo "Docker compose executed successfully" else echo "Error occurred while executing docker compose" exit 1 fi echo "Deployment completed successfully"