forked from platypush/platypush
[Build] Added multiarch support for Docker images.
This commit is contained in:
parent
197e1e91dd
commit
fd07709811
2 changed files with 27 additions and 4 deletions
|
@ -1,11 +1,26 @@
|
||||||
#!/bin/sh
|
#!/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 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"
|
export IMAGE_NAME="$REGISTRY_ENDPOINT/$DOCKER_USER/platypush"
|
||||||
|
|
||||||
|
# Log in to the registry
|
||||||
docker login "$REGISTRY_ENDPOINT" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
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"
|
# Required for multi-platform builds
|
||||||
docker push "$IMAGE_NAME:latest"
|
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
|
||||||
|
|
|
@ -662,6 +662,14 @@ $ docker run -it --name platypush \
|
||||||
quay.io/platypush/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
|
The Web service will be available on `http://localhost:8008`, and a default
|
||||||
configuration file will be initialized under
|
configuration file will be initialized under
|
||||||
`/path/to/your/platypush/config/config.yaml` if not available. The next
|
`/path/to/your/platypush/config/config.yaml` if not available. The next
|
||||||
|
|
Loading…
Reference in a new issue