diff --git a/Dockerfile.arm64 b/Dockerfile similarity index 64% rename from Dockerfile.arm64 rename to Dockerfile index ec981b5..e90e083 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile @@ -1,9 +1,11 @@ FROM golang AS build +ARG arch=amd64 + COPY . /code WORKDIR /code -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo http.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -a -installsuffix cgo http.go FROM scratch diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 deleted file mode 100644 index 086ac9e..0000000 --- a/Dockerfile.amd64 +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang AS build - -COPY . /code -WORKDIR /code - -RUN CGO_ENABLED=0 go build -a -installsuffix cgo http.go - -FROM scratch - -COPY --from=build /code/http /http - -EXPOSE 8080 - -CMD ["/http"] diff --git a/Dockerfile.arm b/Dockerfile.arm deleted file mode 100644 index 87d76e0..0000000 --- a/Dockerfile.arm +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang AS build - -COPY . /code -WORKDIR /code - -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -a -installsuffix cgo http.go - -FROM scratch - -COPY --from=build /code/http /http - -EXPOSE 8080 - -CMD ["/http"] diff --git a/travis-build.sh b/travis-build.sh index 178164f..75a03c2 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -3,25 +3,14 @@ set -e docker version uname -a -echo "Updating Docker engine to 17.05.0" +echo "Updating Docker engine to have multi-stage builds" sudo service docker stop curl -fsSL https://get.docker.com/ | sudo sh docker version -if [ "$ARCH" != "amd64" ]; then - # prepare qemu - docker run --rm --privileged multiarch/qemu-user-static:register --reset - - if [ "$ARCH" == "arm64" ]; then - # prepare qemu binary - docker create --name register hypriot/qemu-register - docker cp register:qemu-aarch64 qemu-aarch64-static - fi -fi - if [ -d tmp ]; then docker rm build rm -rf tmp fi -docker build -t whoami -f "Dockerfile.$ARCH" . +docker build -t whoami --build-arg "arch=$ARCH" . diff --git a/travis-deploy.sh b/travis-deploy.sh index 712c143..b460581 100755 --- a/travis-deploy.sh +++ b/travis-deploy.sh @@ -23,22 +23,28 @@ if [ "$ARCH" == "amd64" ]; then sleep 15 echo "Try again" done + until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG-1709" + do + sleep 15 + echo "Try again" + done set -e echo "Downloading docker client with manifest command" - wget https://5028-88013053-gh.circle-artifacts.com/1/work/build/docker-linux-amd64 + wget https://6582-88013053-gh.circle-artifacts.com/1/work/build/docker-linux-amd64 mv docker-linux-amd64 docker chmod +x docker ./docker version - + set -x - + echo "Pushing manifest $image:$TRAVIS_TAG" ./docker -D manifest create "$image:$TRAVIS_TAG" \ "$image:linux-amd64-$TRAVIS_TAG" \ "$image:linux-arm-$TRAVIS_TAG" \ "$image:linux-arm64-$TRAVIS_TAG" \ - "$image:windows-amd64-$TRAVIS_TAG" + "$image:windows-amd64-$TRAVIS_TAG" \ + "$image:windows-amd64-$TRAVIS_TAG-1709" ./docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm ./docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 ./docker manifest push "$image:$TRAVIS_TAG" @@ -48,26 +54,9 @@ if [ "$ARCH" == "amd64" ]; then "$image:linux-amd64-$TRAVIS_TAG" \ "$image:linux-arm-$TRAVIS_TAG" \ "$image:linux-arm64-$TRAVIS_TAG" \ - "$image:windows-amd64-$TRAVIS_TAG" + "$image:windows-amd64-$TRAVIS_TAG" \ + "$image:windows-amd64-$TRAVIS_TAG-1709" ./docker manifest annotate "$image:latest" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm ./docker manifest annotate "$image:latest" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 ./docker manifest push "$image:latest" - - echo "Downloading manifest-tool" - wget https://github.com/estesp/manifest-tool/releases/download/v0.6.0/manifest-tool-linux-amd64 - mv manifest-tool-linux-amd64 manifest-tool - chmod +x manifest-tool - ./manifest-tool - - echo "Pushing manifest $image:$TRAVIS_TAG" - ./manifest-tool push from-args \ - --platforms linux/amd64,linux/arm,linux/arm64,windows/amd64 \ - --template "$image:OS-ARCH-$TRAVIS_TAG" \ - --target "$image:$TRAVIS_TAG-manifest-tool" - - echo "Pushing manifest $image:latest" - ./manifest-tool push from-args \ - --platforms linux/amd64,linux/arm,linux/arm64,windows/amd64 \ - --template "$image:OS-ARCH-$TRAVIS_TAG" \ - --target "$image:latest-manifest-tool" fi