From fd07709811e9392b041694b305aa583d3b71e5d5 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 12 Nov 2024 00:42:34 +0100 Subject: [PATCH] [Build] Added multiarch support for Docker images. --- .drone/update-image-registry.sh | 23 +++++++++++++++++++---- README.md | 8 ++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.drone/update-image-registry.sh b/.drone/update-image-registry.sh index bdda741ffa..7d6e4969a9 100755 --- a/.drone/update-image-registry.sh +++ b/.drone/update-image-registry.sh @@ -1,11 +1,26 @@ #!/bin/sh +[ -z "$DOCKER_USER" ] && echo "Please set the DOCKER_USER environment variable" && exit 1 +[ -z "$DOCKER_PASS" ] && echo "Please set the DOCKER_PASS environment variable" && exit 1 + export VERSION=$(grep current_version pyproject.toml | sed -r -e "s/.*=\s*['\"]?([^'\"]+)['\"]?\s*$/\1/") +export REGISTRY_ENDPOINT="${REGISTRY_ENDPOINT:-quay.io}" export IMAGE_NAME="$REGISTRY_ENDPOINT/$DOCKER_USER/platypush" +# Log in to the registry docker login "$REGISTRY_ENDPOINT" -u "$DOCKER_USER" -p "$DOCKER_PASS" -docker build -f Dockerfile.alpine -t "$IMAGE_NAME:$VERSION" . -docker tag "$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest" -docker push "$IMAGE_NAME:$VERSION" -docker push "$IMAGE_NAME:latest" +# Required for multi-platform builds +docker buildx create --name=multiarch --driver=docker-container + +# Build and publish the images +docker buildx build \ + -f Dockerfile.alpine \ + -t "$IMAGE_NAME:$VERSION" \ + -t "$IMAGE_NAME:latest" \ + --platform linux/amd64,linux/arm64,linux/arm/v7 \ + --builder multiarch \ + --push . + +# Clean up +docker buildx rm multiarch diff --git a/README.md b/README.md index 329acda56c..74d2a6398d 100644 --- a/README.md +++ b/README.md @@ -662,6 +662,14 @@ $ docker run -it --name platypush \ quay.io/platypush/platypush ``` +The following architectures are currently supported: + +- `amd64`/`x86_64` (standard Intel-based architectures) +- `arm64`/`aarch64` (ARM64, such as modern ARM-based MacBooks, most of the + Android devices or RaspberryPi 4 and 5) +- `armv7l` (older ARM-based devices, such as RaspberryPi 2 and 3 or older + Android devices) + The Web service will be available on `http://localhost:8008`, and a default configuration file will be initialized under `/path/to/your/platypush/config/config.yaml` if not available. The next