From ec54ec22f6bc57ad311514bc2f8887e3069a519b Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 3 Nov 2019 11:38:21 +0100 Subject: [PATCH] Reconfigure build. --- .deploy/docker/build-amd64.sh | 20 ----- .deploy/docker/build-arm.sh | 29 ------- .deploy/docker/build-arm64.sh | 19 ----- .deploy/docker/manifest.sh | 143 +++++++++++++++++++++++++++++----- .deploy/docker/travis.sh | 97 ++++++++++++++++++++++- 5 files changed, 218 insertions(+), 90 deletions(-) delete mode 100755 .deploy/docker/build-amd64.sh delete mode 100755 .deploy/docker/build-arm.sh delete mode 100755 .deploy/docker/build-arm64.sh diff --git a/.deploy/docker/build-amd64.sh b/.deploy/docker/build-amd64.sh deleted file mode 100755 index 51425e09f3..0000000000 --- a/.deploy/docker/build-amd64.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# First build AMD64 image: -echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - -if [ "$TRAVIS_BRANCH" == "develop" ]; then - echo "Build develop amd64" - docker build -t jc5x/firefly-iii:develop-amd64 -f Dockerfile.amd64 . - docker tag jc5x/firefly-iii:develop-amd64 jc5x/firefly-iii:develop-$VERSION-amd64 - docker push jc5x/firefly-iii:develop-amd64 - docker push jc5x/firefly-iii:develop-$VERSION-amd64 -fi - -if [ "$TRAVIS_BRANCH" == "master" ]; then - echo "Build master amd64" - docker build -t jc5x/firefly-iii:latest-amd64 -f Dockerfile.amd64 . - docker tag jc5x/firefly-iii:latest-amd64 jc5x/firefly-iii:release-$VERSION-amd64 - docker push jc5x/firefly-iii:latest-amd64 - docker push jc5x/firefly-iii:release-$VERSION-amd64 -fi diff --git a/.deploy/docker/build-arm.sh b/.deploy/docker/build-arm.sh deleted file mode 100755 index 4ea42d38e9..0000000000 --- a/.deploy/docker/build-arm.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -docker run --rm --privileged multiarch/qemu-user-static:register --reset - -# get qemu-arm-static binary -mkdir tmp -pushd tmp && \ -curl -L -o qemu-arm-static.tar.gz https://github.com/multiarch/qemu-user-static/releases/download/v2.6.0/qemu-arm-static.tar.gz && \ -tar xzf qemu-arm-static.tar.gz && \ -popd - -# build image -echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - -if [ "$TRAVIS_BRANCH" == "develop" ]; then - echo "Build develop arm" - docker build --tag jc5x/firefly-iii:develop-arm --file Dockerfile.arm . - docker tag jc5x/firefly-iii:develop-arm jc5x/firefly-iii:develop-$VERSION-arm - docker push jc5x/firefly-iii:develop-arm - docker push jc5x/firefly-iii:develop-$VERSION-arm -fi - -if [ "$TRAVIS_BRANCH" == "master" ]; then - echo "Build master arm" - docker build --tag jc5x/firefly-iii:latest-arm --file Dockerfile.arm . - docker tag jc5x/firefly-iii:latest-arm jc5x/firefly-iii:release-$VERSION-arm - docker push jc5x/firefly-iii:latest-arm - docker push jc5x/firefly-iii:release-$VERSION-arm -fi \ No newline at end of file diff --git a/.deploy/docker/build-arm64.sh b/.deploy/docker/build-arm64.sh deleted file mode 100755 index 36434fcbf6..0000000000 --- a/.deploy/docker/build-arm64.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - -if [ "$TRAVIS_BRANCH" == "develop" ]; then - echo "Build develop arm64" - docker build -t jc5x/firefly-iii:develop-arm64 -f Dockerfile.arm64 . - docker tag jc5x/firefly-iii:develop-arm64 jc5x/firefly-iii:develop-$VERSION-arm64 - docker push jc5x/firefly-iii:develop-arm64 - docker push jc5x/firefly-iii:develop-$VERSION-arm64 -fi - -if [ "$TRAVIS_BRANCH" == "master" ]; then - echo "Build master arm64" - docker build -t jc5x/firefly-iii:latest-arm64 -f Dockerfile.arm64 . - docker tag jc5x/firefly-iii:latest-arm64 jc5x/firefly-iii:release-$VERSION-arm64 - docker push jc5x/firefly-iii:latest-arm64 - docker push jc5x/firefly-iii:release-$VERSION-arm64 -fi \ No newline at end of file diff --git a/.deploy/docker/manifest.sh b/.deploy/docker/manifest.sh index bf7c8cfdce..0d1ce25555 100755 --- a/.deploy/docker/manifest.sh +++ b/.deploy/docker/manifest.sh @@ -8,13 +8,17 @@ sudo service docker restart echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -if [ "$TRAVIS_BRANCH" == "develop" ]; then - TARGET=jc5x/firefly-iii:develop +# if the github branch is develop, only push the 'develop' tag +if [ $TRAVIS_BRANCH == "develop" ]; then + TARGET=jc5x/firefly-iii:develop ARM32=jc5x/firefly-iii:develop-arm ARM64=jc5x/firefly-iii:develop-arm64 AMD64=jc5x/firefly-iii:develop-amd64 + echo "GitHub branch is $TRAVIS_BRANCH." + echo "Push develop-* builds to $TARGET" + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 docker manifest annotate $TARGET $ARM32 --arch arm --os linux docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux @@ -22,30 +26,129 @@ if [ "$TRAVIS_BRANCH" == "develop" ]; then docker manifest push $TARGET fi -if [ "$TRAVIS_BRANCH" == "master" ]; then +# if branch = master AND channel = alpha, push 'alpha' +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "alpha" ]; then + TARGET=jc5x/firefly-iii:alpha + ARM32=jc5x/firefly-iii:alpha-arm + ARM64=jc5x/firefly-iii:alpha-arm64 + AMD64=jc5x/firefly-iii:alpha-amd64 + + echo "GitHub branch is $TRAVIS_BRANCH." + echo "Channel is $CHANNEL." + echo "Push alpha-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET +fi + +# if branch is master and channel is alpha, push 'alpha' and 'beta'. +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "beta" ]; then + TARGET=jc5x/firefly-iii:alpha + ARM32=jc5x/firefly-iii:beta-arm + ARM64=jc5x/firefly-iii:beta-arm64 + AMD64=jc5x/firefly-iii:beta-amd64 + + echo "GitHub branch is $TRAVIS_BRANCH." + echo "Channel is $CHANNEL." + echo "Push beta-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET + + TARGET=jc5x/firefly-iii:beta + ARM32=jc5x/firefly-iii:beta-arm + ARM64=jc5x/firefly-iii:beta-arm64 + AMD64=jc5x/firefly-iii:beta-amd64 + + echo "Push beta-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET +fi + +# if branch is master and channel is stable, push 'alpha' and 'beta' and 'stable'. +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "stable" ]; then + TARGET=jc5x/firefly-iii:alpha + ARM32=jc5x/firefly-iii:stable-arm + ARM64=jc5x/firefly-iii:stable-arm64 + AMD64=jc5x/firefly-iii:stable-amd64 + + echo "GitHub branch is $TRAVIS_BRANCH." + echo "Channel is $CHANNEL." + echo "Push stable-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET + + TARGET=jc5x/firefly-iii:beta + ARM32=jc5x/firefly-iii:stable-arm + ARM64=jc5x/firefly-iii:stable-arm64 + AMD64=jc5x/firefly-iii:stable-amd64 + + echo "Push stable-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET + + TARGET=jc5x/firefly-iii:stable + ARM32=jc5x/firefly-iii:stable-arm + ARM64=jc5x/firefly-iii:stable-arm64 + AMD64=jc5x/firefly-iii:stable-amd64 + + echo "Push stable-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET + TARGET=jc5x/firefly-iii:latest + ARM32=jc5x/firefly-iii:stable-arm + ARM64=jc5x/firefly-iii:stable-arm64 + AMD64=jc5x/firefly-iii:stable-amd64 - ARM32=jc5x/firefly-iii:latest-arm - ARM64=jc5x/firefly-iii:latest-arm64 - AMD64=jc5x/firefly-iii:latest-amd64 - + echo "Push stable-* builds to $TARGET" docker manifest create $TARGET $ARM32 $ARM64 $AMD64 docker manifest annotate $TARGET $ARM32 --arch arm --os linux docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux docker manifest push $TARGET - - # and another one for version specific: - VERSION_TARGET=jc5x/firefly-iii:release-$VERSION - - VERSION_ARM32=jc5x/firefly-iii:release-$VERSION-arm - VERSION_ARM64=jc5x/firefly-iii:release-$VERSION-arm64 - VERSION_AMD64=jc5x/firefly-iii:release-$VERSION-amd64 - - docker manifest create $VERSION_TARGET $VERSION_ARM32 $VERSION_ARM64 $VERSION_AMD64 - docker manifest annotate $VERSION_TARGET $VERSION_ARM32 --arch arm --os linux - docker manifest annotate $VERSION_TARGET $VERSION_ARM64 --arch arm64 --os linux - docker manifest annotate $VERSION_TARGET $VERSION_AMD64 --arch amd64 --os linux - docker manifest push $VERSION_TARGET fi + +# push to channel 'version' if master +if [ $TRAVIS_BRANCH == "master" ]; then + TARGET=jc5x/firefly-iii:release-$VERSION + ARM32=jc5x/firefly-iii:stable-arm + ARM64=jc5x/firefly-iii:stable-arm64 + AMD64=jc5x/firefly-iii:stable-amd64 + + echo "GitHub branch is $TRAVIS_BRANCH." + echo "Channel is $CHANNEL." + echo "Push stable-* builds to $TARGET" + + docker manifest create $TARGET $ARM32 $ARM64 $AMD64 + docker manifest annotate $TARGET $ARM32 --arch arm --os linux + docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux + docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux + docker manifest push $TARGET +fi + +echo 'Done!' +# done! \ No newline at end of file diff --git a/.deploy/docker/travis.sh b/.deploy/docker/travis.sh index a61a13ecd6..f694c33cb5 100755 --- a/.deploy/docker/travis.sh +++ b/.deploy/docker/travis.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "I am building channel ${CHANNEL} for version ${VERSION} on architecture ${ARCH}." +echo "travis.sh: I am building channel ${CHANNEL} for version ${VERSION} on architecture ${ARCH}." echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json mkdir $HOME/.docker @@ -9,4 +9,97 @@ echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json sudo service docker restart # build everything -.deploy/docker/build-$ARCH.sh +echo "Now building $ARCH" + +# First build amd64 image: +echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + +if [$ARCH == "arm"]; then + docker run --rm --privileged multiarch/qemu-user-static:register --reset + + # get qemu-arm-static binary + mkdir tmp + pushd tmp && \ + curl -L -o qemu-arm-static.tar.gz https://github.com/multiarch/qemu-user-static/releases/download/v2.6.0/qemu-arm-static.tar.gz && \ + tar xzf qemu-arm-static.tar.gz && \ + popd +fi + +# if the github branch is develop, build and push develop. Don't push a version tag anymore. +if [ $TRAVIS_BRANCH == "develop" ]; then + LABEL=jc5x/firefly-iii:develop-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH. Will build and push $LABEL" + docker build -t $LABEL -f Dockerfile.$ARCH . + docker push $LABEL +fi + +# if branch = master AND channel = alpha, build and push 'alpha' +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "alpha" ]; then + LABEL=jc5x/firefly-iii:alpha-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will build and push $LABEL" + docker build -t $LABEL -f Dockerfile.$ARCH . + docker push $LABEL +fi + +# if branch is master and channel is alpha, build and push 'alpha' and 'beta'. +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "beta" ]; then + LABEL=jc5x/firefly-iii:beta-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will build and push $LABEL" + docker build -t $LABEL -f Dockerfile.$ARCH . + docker push $LABEL + + # then tag as alpha and push: + docker tag $LABEL jc5x/firefly-iii:alpha-$ARCH + docker push jc5x/firefly-iii:alpha-$ARCH + echo "Also tagged $LABEL as jc5x/firefly-iii:alpha-$ARCH and pushed" +fi + +# if branch is master and channel is stable, push 'alpha' and 'beta' and 'stable'. +if [ $TRAVIS_BRANCH == "master" ] && [ $CHANNEL == "stable" ]; then + # first build stable + LABEL=jc5x/firefly-iii:stable-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will build and push $LABEL" + docker build -t $LABEL -f Dockerfile.$ARCH . + docker push $LABEL + + # then tag as beta and push: + docker tag $LABEL jc5x/firefly-iii:beta-$ARCH + docker push jc5x/firefly-iii:beta-$ARCH + echo "Also tagged $LABEL as jc5x/firefly-iii:beta-$ARCH and pushed" + + # then tag as alpha and push: + docker tag $LABEL jc5x/firefly-iii:alpha-$ARCH + docker push jc5x/firefly-iii:alpha-$ARCH + echo "Also tagged $LABEL as jc5x/firefly-iii:alpha-$ARCH and pushed" + + # then tag as latest and push: + docker tag $LABEL jc5x/firefly-iii:latest-$ARCH + docker push jc5x/firefly-iii:latest-$ARCH + echo "Also tagged $LABEL as jc5x/firefly-iii:latest-$ARCH and pushed" +fi + +# push to channel 'version' if master + alpha +if [ $TRAVIS_BRANCH == "master" ] && [$CHANNEL == "alpha"]; then + LABEL=jc5x/firefly-iii:version-$VERSION-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will also push alpha as $LABEL" + docker tag jc5x/firefly-iii:alpha-$ARCH $LABEL + docker push $LABEL +fi + +# push to channel 'version' if master + beta +if [ $TRAVIS_BRANCH == "master" ] && [$CHANNEL == "beta"]; then + LABEL=jc5x/firefly-iii:version-$VERSION-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will also push beta as $LABEL" + docker tag jc5x/firefly-iii:beta-$ARCH $LABEL + docker push $LABEL +fi + +# push to channel 'version' if master + stable +if [ $TRAVIS_BRANCH == "master" ] && [$CHANNEL == "stable"]; then + LABEL=jc5x/firefly-iii:version-$VERSION-$ARCH + echo "GitHub branch is $TRAVIS_BRANCH and channel is $CHANNEL. Will also push beta as $LABEL" + docker tag jc5x/firefly-iii:stable-$ARCH $LABEL + docker push $LABEL +fi + +echo "Done!" \ No newline at end of file