2024-11-10 15:23:04 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-11-12 00:42:34 +01:00
|
|
|
[ -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
|
|
|
|
|
2024-11-10 15:23:04 +01:00
|
|
|
export VERSION=$(grep current_version pyproject.toml | sed -r -e "s/.*=\s*['\"]?([^'\"]+)['\"]?\s*$/\1/")
|
2024-11-12 00:42:34 +01:00
|
|
|
export REGISTRY_ENDPOINT="${REGISTRY_ENDPOINT:-quay.io}"
|
2024-11-10 15:23:04 +01:00
|
|
|
export IMAGE_NAME="$REGISTRY_ENDPOINT/$DOCKER_USER/platypush"
|
|
|
|
|
2024-11-12 00:42:34 +01:00
|
|
|
# Log in to the registry
|
2024-11-10 15:23:04 +01:00
|
|
|
docker login "$REGISTRY_ENDPOINT" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
|
|
|
|
2024-11-12 00:42:34 +01:00
|
|
|
# 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
|