46 lines
1.1 KiB
Bash
Executable file
46 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
PHP_VERSIONS="7.4 8.1 8.2"
|
|
WKHTML=""
|
|
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
|
|
|
|
for PHP_VERSION in ${WKHTML}; do
|
|
build "${PHP_VERSION}-wkhtml" "${PHP_VERSION}" "--build-arg WKHTML=1"
|
|
done
|
|
|
|
docker buildx rm multi-platform-builder --force
|
|
docker image prune -a --force
|
|
|
|
docker logout "http://git.paucapo.com/"
|