diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3c8388e..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -jobs: - build: - working_directory: ~/whoami - machine: true - steps: - - checkout - - run: ARCH=arm ./travis-build.sh - - run: ARCH=arm ./travis-test.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 27b7ce5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: required - -services: - - docker - -env: - matrix: - - ARCH=arm - - ARCH=arm64 - - ARCH=amd64 - -script: - - ./travis-build.sh - - ./travis-test.sh - - > - if [ -n "$TRAVIS_TAG" ]; then - # push image - travis_retry timeout 5m echo "$DOCKER_PASS" | docker login -u="$DOCKER_USER" --password-stdin - ./travis-deploy.sh - fi diff --git a/README.md b/README.md index fce36f7..1efd933 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # whoami multi-arch image [![Build status](https://ci.appveyor.com/api/projects/status/bhma7tmx0eje73ao/branch/master?svg=true)](https://ci.appveyor.com/project/StefanScherer/whoami/branch/master) -[![Build Status](https://travis-ci.org/StefanScherer/whoami.svg?branch=master)](https://travis-ci.org/StefanScherer/whoami) [![This image on DockerHub](https://img.shields.io/docker/pulls/stefanscherer/whoami.svg)](https://hub.docker.com/r/stefanscherer/whoami/) Simple HTTP docker service that prints it's container ID - for (almost) any Docker platform @@ -11,15 +10,16 @@ Simple HTTP docker service that prints it's container ID - for (almost) any Dock ![CI pipeline with Travis and AppVeyor](images/pipeline.png) * AppVeyor CI - * Build Windows image for nanoserver 2016 SAC - * windows/amd64 10.0.14393.x - * Rebase this image to nanoserver:1709 SAC - * windows/amd64 10.0.16299.x -* Travis CI * Matrix build for several Linux architectures * linux/amd64 * linux/arm * linux/arm64 + * Build Windows image for nanoserver 2016 SAC + * windows/amd64 10.0.14393.x + * Rebase this image to nanoserver:1709 SAC + * windows/amd64 10.0.16299.x + * Rebase this image to nanoserver:1803 SAC + * windows/amd64 10.0.17134.x * Wait for all images to be on Docker Hub * Create and push the manifest list * preview of `docker manifest` command @@ -54,6 +54,7 @@ Image: stefanscherer/whoami - linux/amd64 - linux/arm/v6 - linux/arm64/v8 - - windows/amd64:10.0.14393.2068 - - windows/amd64:10.0.16299.248 + - windows/amd64:10.0.14393.2248 + - windows/amd64:10.0.16299.431 + - windows/amd64:10.0.17134.48 ``` diff --git a/appveyor-build.ps1 b/appveyor-build.ps1 deleted file mode 100644 index f0e6143..0000000 --- a/appveyor-build.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -$ErrorActionPreference = 'Stop'; -$files = "" -Write-Host Starting build - -docker build --pull -t whoami -f Dockerfile.windows . - -docker images diff --git a/appveyor-deploy.ps1 b/appveyor-deploy.ps1 deleted file mode 100644 index 2aac154..0000000 --- a/appveyor-deploy.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -$ErrorActionPreference = 'Stop'; - -if (! (Test-Path Env:\APPVEYOR_REPO_TAG_NAME)) { - Write-Host "No version tag detected. Skip publishing." - exit 0 -} - -Write-Host Starting deploy -docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS" - -docker tag whoami stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME - -docker push stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME - -Write-Host Rebasing image to produce 1709 variant -npm install -g rebase-docker-image -rebase-docker-image ` - stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME ` - -t stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709 ` - -b microsoft/nanoserver:1709 - -Write-Host Rebasing image to produce 1803 variant -npm install -g rebase-docker-image -rebase-docker-image ` - stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME ` - -t stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803 ` - -b microsoft/nanoserver:1803 diff --git a/appveyor.yml b/appveyor.yml index 3e73190..342cba4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,18 +1,26 @@ version: 1.0.{build} -image: Visual Studio 2017 +image: +- Visual Studio 2017 +- Ubuntu + +environment: + matrix: + - ARCH: arm + - ARCH: arm64 + - ARCH: amd64 + +matrix: + exclude: + - image: Visual Studio 2017 + ARCH: arm + - image: Visual Studio 2017 + ARCH: arm64 build_script: - - ps: .\appveyor-build.ps1 + - ps: ./build.ps1 test_script: - - ps: .\appveyor-test.ps1 + - ps: ./test.ps1 deploy_script: - - ps: >- - if (Test-Path Env:\APPVEYOR_REPO_TAG_NAME) { - - docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS" - - .\appveyor-deploy.ps1 - - } + - ps: ./deploy.ps1 diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..cd18301 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,11 @@ +$ErrorActionPreference = 'Stop'; +$files = "" +Write-Host Starting build + +if ($isWindows) { + docker build --pull -t whoami -f Dockerfile.windows . +} else { + docker build -t whoami --build-arg "arch=$env:ARCH" . +} + +docker images diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 0000000..2bd68bc --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,62 @@ +$ErrorActionPreference = 'Stop'; + +if (! (Test-Path Env:\APPVEYOR_REPO_TAG_NAME)) { + Write-Host "No version tag detected. Skip publishing." + exit 0 +} + +$image = "stefanscherer/whoami" + +Write-Host Starting deploy +if (!(Test-Path ~/.docker)) { mkdir ~/.docker } +'{ "experimental": "enabled" }' | Out-File ~/.docker/config.json -Encoding Ascii +docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS" + +$os = If ($isWindows) {"windows"} Else {"linux"} +docker tag whoami "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" +docker push "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" + +if ($isWindows) { + # Windows + Write-Host "Rebasing image to produce 1709 variant" + npm install -g rebase-docker-image + rebase-docker-image ` + "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" ` + -t "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME-1709" ` + -b microsoft/nanoserver:1709 + + Write-Host "Rebasing image to produce 1803 variant" + npm install -g rebase-docker-image + rebase-docker-image ` + "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" ` + -t "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME-1803" ` + -b microsoft/nanoserver:1803 + +} else { + # Linux + if ($env:ARCH -eq "amd64") { + # The last in the build matrix + docker -D manifest create "$($image):$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):linux-amd64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803" + docker manifest annotate "$($image):$env:APPVEYOR_REPO_TAG_NAME" "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm --variant v6 + docker manifest annotate "$($image):$env:APPVEYOR_REPO_TAG_NAME" "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm64 --variant v8 + docker manifest push "$($image):$env:APPVEYOR_REPO_TAG_NAME" + + Write-Host "Pushing manifest $($image):latest" + docker -D manifest create "$($image):latest" ` + "$($image):linux-amd64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709" ` + "$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803" + docker manifest annotate "$($image):latest" "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm --variant v6 + docker manifest annotate "$($image):latest" "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm64 --variant v8 + docker manifest push "$($image):latest" + } +} diff --git a/images/pipeline.png b/images/pipeline.png index 5a84009..423c6e7 100644 Binary files a/images/pipeline.png and b/images/pipeline.png differ diff --git a/appveyor-test.ps1 b/test.ps1 similarity index 79% rename from appveyor-test.ps1 rename to test.ps1 index 063d136..2ac2bdd 100644 --- a/appveyor-test.ps1 +++ b/test.ps1 @@ -1,5 +1,10 @@ Write-Host Starting test +if ($env:ARCH -ne "amd64") { + Write-Host "Arch $env:ARCH detected. Skip testing." + exit 0 +} + $ErrorActionPreference = 'SilentlyContinue'; docker kill whoamitest docker rm -f whoamitest diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index 559045d..0000000 --- a/travis-build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -docker version -uname -a - -echo "Updating Docker engine to have multi-stage builds and manifest command" -sudo service docker stop -curl -fsSL https://get.docker.com/ | sudo sh - -echo "Enabling docker client experimental features" -mkdir -p ~/.docker -echo '{ "experimental": "enabled" }' > ~/.docker/config.json - -docker version - -if [ -d tmp ]; then - docker rm build - rm -rf tmp -fi - -docker build -t whoami --build-arg "arch=$ARCH" . diff --git a/travis-deploy.sh b/travis-deploy.sh deleted file mode 100755 index d11a493..0000000 --- a/travis-deploy.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -set -e - -image="stefanscherer/whoami" -docker tag whoami "$image:linux-$ARCH-$TRAVIS_TAG" -docker push "$image:linux-$ARCH-$TRAVIS_TAG" - -if [ "$ARCH" == "amd64" ]; then - set +e - echo "Waiting for other images $image:linux-arm-$TRAVIS_TAG" - until docker run --rm stefanscherer/winspector "$image:linux-arm-$TRAVIS_TAG" - do - sleep 15 - echo "Try again" - done - until docker run --rm stefanscherer/winspector "$image:linux-arm64-$TRAVIS_TAG" - do - sleep 15 - echo "Try again" - done - until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG" - do - 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 - until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG-1803" - do - sleep 15 - echo "Try again" - done - set -e - - 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-1709" \ - "$image:windows-amd64-$TRAVIS_TAG-1803" - docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm --variant v6 - docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 --variant v8 - docker manifest push "$image:$TRAVIS_TAG" - - echo "Pushing manifest $image:latest" - docker -D manifest create "$image:latest" \ - "$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-1709" \ - "$image:windows-amd64-$TRAVIS_TAG-1803" - docker manifest annotate "$image:latest" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm --variant v6 - docker manifest annotate "$image:latest" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 --variant v8 - docker manifest push "$image:latest" -fi diff --git a/travis-test.sh b/travis-test.sh deleted file mode 100755 index d497daa..0000000 --- a/travis-test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -if [ "$ARCH" == "amd64" ]; then - # test image - docker run -d -p 8080:8080 --name=whoamitest whoami - - sleep 5 - - docker logs whoamitest -fi