#!/bin/bash # Create a build log file LOG_FILE="build.log" # Function to log messages with timestamps log_message() { echo "$(date '+%Y-%m-%d %H:%M:%S') - \$1" >> "$LOG_FILE" } # Create a new buildx builder and use it docker buildx create --use # Array of PHP versions and types declare -a PHP_VERSIONS=("8.1" "8.2" "8.3" "8.4") declare -a BUILD_TYPES=("workerman" "grpc") # Loop through each PHP version and build type for VERSION in "${PHP_VERSIONS[@]}"; do for TYPE in "${BUILD_TYPES[@]}"; do IMAGE_TAG="quay.io/wandoubaba517/php:${VERSION}-${TYPE}" DOCKERFILE="Dockerfile_${VERSION}-${TYPE}" # Build the Docker image if docker buildx build --platform linux/amd64,linux/arm64 --push -t "$IMAGE_TAG" -f "$DOCKERFILE" .; then log_message "SUCCESS: Built and pushed $IMAGE_TAG" else log_message "FAILURE: Failed to build $IMAGE_TAG" fi done done