Fix Docker images having the wrong platform (#952)

* travis: Update Docker and add experimental support

* travis: Build images with experimental --platform

* Update docker.sh
This commit is contained in:
Mikkel Kroman 2019-01-27 20:32:52 +01:00 committed by Koen Kanters
parent 85375ffbae
commit 73f0f8fe43
2 changed files with 13 additions and 7 deletions

View File

@ -8,6 +8,12 @@ services:
node_js:
- "10"
+before_install:
- "echo '{\"experimental\": true}' | sudo tee /etc/docker/daemon.json"
- sudo apt update -y
- sudo apt install --only-upgrade docker-ce -y
- sudo service docker restart
install:
- npm install

View File

@ -10,7 +10,7 @@ tag_push() {
}
build_and_push() {
docker build --build-arg COMMIT=$(git rev-parse --short HEAD) -t $DOCKER_USERNAME/zigbee2mqtt:$1 -f $2 .
docker build --platform=$3 --build-arg COMMIT=$(git rev-parse --short HEAD) -t $DOCKER_USERNAME/zigbee2mqtt:$1 -f $2 .
docker push $DOCKER_USERNAME/zigbee2mqtt:$1
}
@ -23,9 +23,9 @@ then
login
# Push versioned images
build_and_push "$TRAVIS_TAG" docker/Dockerfile.amd64
build_and_push "$TRAVIS_TAG-arm32v6" docker/Dockerfile.arm32v6
build_and_push "$TRAVIS_TAG-arm64v8" docker/Dockerfile.arm64v8
build_and_push "$TRAVIS_TAG" docker/Dockerfile.amd64 amd64
build_and_push "$TRAVIS_TAG-arm32v6" docker/Dockerfile.arm32v6 arm
build_and_push "$TRAVIS_TAG-arm64v8" docker/Dockerfile.arm64v8 arm64
# Push latest images.
tag_push "$TRAVIS_TAG-arm32v6" "arm32v6"
@ -35,9 +35,9 @@ elif [ "$TRAVIS_BRANCH" = "dev" -a "$TRAVIS_PULL_REQUEST" = "false" ]
then
echo "Updating docker images for dev branch!"
login
build_and_push latest-dev docker/Dockerfile.amd64
build_and_push arm32v6-dev docker/Dockerfile.arm32v6
build_and_push arm64v8-dev docker/Dockerfile.arm64v8
build_and_push latest-dev docker/Dockerfile.amd64 amd64
build_and_push arm32v6-dev docker/Dockerfile.arm32v6 arm
build_and_push arm64v8-dev docker/Dockerfile.arm64v8 arm64
else
echo "Not updating docker images, triggered by pull request or not on master/dev branch"
fi