#!/bin/sh

# Exit immediately if a command exits with a non-zero status.
set -e

# Log the start of the update process
echo "Starting website update process..."

# Navigate to the project directory
cd "$(dirname "$0")/.."

# Build the Docker image if it doesn't exist
echo "Checking for Docker image..."
if ! docker compose ls | grep -q "builder"; then
  echo "Docker image not found. Building image..."
  docker compose build
fi

# Start the builder container
echo "Starting builder container..."
docker compose run --rm builder

# Log the successful completion of the update process
echo "Website update process completed successfully!"
