Merge pull request #3 from StefanScherer/add-win-1709

Add Windows Server 1709 variant, refactorings
pull/4/head 1.5.0
Stefan Scherer 7 years ago committed by GitHub
commit 183fd91be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -1,14 +0,0 @@
FROM stefanscherer/golang-windows:1709 AS build
COPY . /code
WORKDIR /code
RUN go build http.go
FROM microsoft/nanoserver:1709
COPY --from=build /code/http.exe /http.exe
EXPOSE 8080
CMD ["\\http.exe"]

@ -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"]

@ -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"]

@ -1,14 +0,0 @@
FROM stefanscherer/golang-windows:1.9-insider AS build
COPY . /code
WORKDIR /code
RUN go build http.go
FROM microsoft/nanoserver-insider
COPY --from=build /code/http.exe /http.exe
EXPOSE 8080
CMD ["\\http.exe"]

@ -1,11 +1,14 @@
FROM golang:nanoserver AS build
ARG golang=golang:nanoserver
ARG target=microsoft/nanoserver
FROM $golang AS build
COPY . /code
WORKDIR /code
RUN go build http.go
FROM microsoft/nanoserver
FROM $target
COPY --from=build /code/http.exe /http.exe

@ -2,9 +2,6 @@ $ErrorActionPreference = 'Stop';
$files = ""
Write-Host Starting build
Write-Host Updating base images
docker pull microsoft/nanoserver
docker build -t whoami -f Dockerfile.windows .
docker build --pull -t whoami -f Dockerfile.windows .
docker images

@ -11,3 +11,10 @@ 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

@ -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" .

@ -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

Loading…
Cancel
Save