#!/bin/bash PHP_VERSIONS="7.4 8.0 8.1 8.2 8.4" PLATFORMS="linux/arm64/v8,linux/amd64" # testing #PHP_VERSIONS="7.4" #PHP_VERSIONS="8.1" #PLATFORMS="linux/arm64/v8" #PLATFORMS="linux/amd64" SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) function build() { PACKAGE="php:$1" PHP_VERSION="$2" echo "Building ${PACKAGE}" docker buildx build \ --no-cache \ --platform=${PLATFORMS} \ --push \ -f "${SCRIPT_DIR}/Dockerfile-php" \ -t "git.paucapo.com/server/${PACKAGE}" \ --build-arg PHP_VERSION=${PHP_VERSION} \ $3 \ "$SCRIPT_DIR" } docker login --username paucapo "http://git.paucapo.com/" docker buildx create --use --platform=linux/arm64/v8,linux/amd64 --name multi-platform-builder docker buildx inspect --bootstrap for PHP_VERSION in ${PHP_VERSIONS}; do build ${PHP_VERSION} ${PHP_VERSION} done docker buildx rm multi-platform-builder --force docker image prune -a --force docker logout "http://git.paucapo.com/"