Skip to content

Instantly share code, notes, and snippets.

@jsturtevant
Last active July 9, 2020 00:03
Show Gist options
  • Save jsturtevant/d0abc2b7873b78757bf93447bfe46428 to your computer and use it in GitHub Desktop.
Save jsturtevant/d0abc2b7873b78757bf93447bfe46428 to your computer and use it in GitHub Desktop.
Windows pause image from scratch
ARG nanoserverTag="mcr.microsoft.com/windows/nanoserver:1809-amd64"
ARG sigWindowsTag=master
ARG windowsTestingTag=master
FROM --platform=$BUILDPLATFORM golang:1.14 as builder
RUN go get -d github.com/kubernetes-sigs/windows-testing || true
RUN go get -d github.com/kubernetes-sigs/sig-windows-tools || true
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /app/pauseloop.exe /go/src/github.com/kubernetes-sigs/windows-testing/images/pause/
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /app/wincat.exe /go/src/github.com/kubernetes-sigs/sig-windows-tools/cmd/wincat/
FROM ${nanoserverTag}
COPY --from=builder "/app/wincat.exe" "/windows/system32/wincat.exe"
COPY --from=builder "/app/pauseloop.exe" "/windows/system32/pauseloop.exe"
CMD pauseloop.exe
docker buildx create --name img-builder --use
docker buildx build --no-cache --pull --push --platform "windows/amd64" -t jsturtevant/test-win:1 -f Dockerfile .
docker buildx rm img-builder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment