Skip to content

Commit

Permalink
Fix docker manifests to work on arm64/v8
Browse files Browse the repository at this point in the history
  • Loading branch information
imduffy15 committed Dec 23, 2019
1 parent c18f847 commit 49dde8b
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions .travis.yml
Expand Up @@ -10,51 +10,27 @@ script:
# Setup QEMU for ARM image build
- docker run --rm --privileged multiarch/qemu-user-static:register
# Build image
- docker build -t diyhue/core:$ARCH -f ./.build/$ARCH.Dockerfile .
- docker build -t imduffy15/diyhue:$ARCH -f ./.build/$ARCH.Dockerfile .
# Login, tag and push dev image
#- docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
#- docker tag diyhue/core:$ARCH diyhue/core:$ARCH-dev
#- docker push diyhue/core:$ARCH-dev
#- docker tag imduffy15/diyhue:$ARCH imduffy15/diyhue:$ARCH-dev
#- docker push imduffy15/diyhue:$ARCH-dev
# Pull dev image to run tests
- docker run -d --name "diyHue" --network="host" -v '/mnt/hue-emulator/export/':'/opt/hue-emulator/export/':'rw' -e 'MAC=b8:27:eb:d4:dc:11' -e 'IP=192.168.1.123' -e 'DECONZ=192.168.1.111' -e 'IP_RANGE=5,200' -e 'DEBUG=true' diyhue/core:$ARCH
- docker run -d --name "diyHue" --network="host" -v '/mnt/hue-emulator/export/':'/opt/hue-emulator/export/':'rw' -e 'MAC=b8:27:eb:d4:dc:11' -e 'IP=192.168.1.123' -e 'DECONZ=192.168.1.111' -e 'IP_RANGE=5,200' -e 'DEBUG=true' imduffy15/diyhue:$ARCH
# Wait for logs to populate, then list them
- sleep 30
- docker logs diyHue
# Kill and remove test container
- docker kill diyHue
- docker rm diyHue
- docker history diyhue/core:$ARCH
- docker history imduffy15/diyhue:$ARCH
- docker images

after_success:
- >
# do not push pull requests
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [[ $TRAVIS_BRANCH != *"-"* ]]; then
# login to docker hub
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
# install manifest tool
wget -O /tmp/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64
chmod +x /tmp/manifest-tool
# push version if tagged
if [ "$TRAVIS_BRANCH" == "$TRAVIS_TAG" ]; then
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_TAG-$ARCH && docker push diyhue/core:$TRAVIS_TAG-$ARCH
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH-$TRAVIS_TAG" --target "diyhue/core:$TRAVIS_BRANCH-$TRAVIS_TAG"
else
# push branch-arch
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_BRANCH-$ARCH && docker push diyhue/core:$TRAVIS_BRANCH-$ARCH
# push branch-arch-commit id
docker tag diyhue/core:$ARCH diyhue/core:$TRAVIS_BRANCH-$ARCH-$TRAVIS_COMMIT && docker push diyhue/core:$TRAVIS_BRANCH-$ARCH-$TRAVIS_COMMIT
# push branch-latest
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH" --target "diyhue/core:$TRAVIS_BRANCH-latest"
# push branch-commit id
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH-$TRAVIS_COMMIT" --target "diyhue/core:$TRAVIS_BRANCH-$TRAVIS_COMMIT"
fi
if [ "$TRAVIS_BRANCH" == "master" ]; then
# push latest if master branch
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm --template "diyhue/core:$TRAVIS_BRANCH-ARCH" --target "diyhue/core:latest"
fi
notifications:
slack: diyhue:84x97ehqLW4B6pe9ntP16SOI
if [ "$TRAVIS_BRANCH" == "master" ]; then
# push latest if master branch
docker tag imduffy15/diyhue:latest imduffy15/diyhue:latest- && docker push imduffy15/diyhue:latest
docker tag imduffy15/diyhue:$ARCH imduffy15/diyhue:latest-$ARCH && docker push imduffy15/diyhue:latest-$ARCH
/tmp/manifest-tool push from-args --ignore-missing --platforms linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 --template "imduffy15/diyhue:$TRAVIS_BRANCH-ARCH" --target "imduffy15/diyhue:latest"
fi

0 comments on commit 49dde8b

Please sign in to comment.