#!/bin/bash
PHP_VERSIONS="7.4 8.2"
WKHTML=""
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=linux/arm64/v8,linux/amd64 \
--push \
-f "${SCRIPT_DIR}/Dockerfile-php" \
-t "git.paucapo.com/server/${PACKAGE}" \
--build-arg PHP_VERSION=${PHP_VERSION} \
$3 \
"$SCRIPT_DIR"
# docker push "git.paucapo.com/server/${PACKAGE}"
}
docker login "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
for PHP_VERSION in ${WKHTML}; do
build "${PHP_VERSION}-wkhtml" "${PHP_VERSION}" "--build-arg WKHTML=1"
done
docker image prune -a --force