docker-postfix/build.sh
Bojan Čekrlić 1caf4104ba Move from Docker Hub builds to GitHub Actions
This allows us to create do a multi-arch build, resulting in
an image which is useful even on low-end IoT devices.
2020-01-31 21:07:42 +01:00

25 lines
673 B
Bash
Executable file

#!/usr/bin/env bash
# Do a multistage build
export DOCKER_BUILDKIT=1
export DOCKER_CLI_EXPERIMENTAL=enabled
if ! docker buildx inspect multiarch > /dev/null; then
docker buildx create --name multiarch
fi
docker buildx use multiarch
if [[ "$*" == *--push* ]]; then
if [[ -n "$DOCKER_USERNAME" ]] && [[ -n "$DOCKER_PASSWORD" ]]; then
echo "Logging into docker registry $DOCKER_REGISTRY_URL...."
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USERNAME --password-stdin $DOCKER_REGISTRY_URL
fi
fi
if [[ -z "$PLATFORMS" ]]; then
PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7"
fi
docker buildx build --platform $PLATFORMS . $*