forked from aws/aws-node-termination-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.windows
31 lines (24 loc) · 994 Bytes
/
Dockerfile.windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
ARG WINDOWS_VERSION=1809
# Build the manager binary
FROM --platform=windows/amd64 golang:1.21 as builder
## GOLANG env
ENV GO111MODULE="on" CGO_ENABLED="0" GOOS="windows" GOARCH="amd64"
ARG GOPROXY="https://proxy.golang.org|direct"
# Copy go.mod and download dependencies
WORKDIR /node-termination-handler
COPY go.mod .
COPY go.sum .
RUN go mod download -x
# Build
COPY . .
RUN go build -ldflags="-s" -a -tags nth${GOOS} -o build/node-termination-handler cmd/node-termination-handler.go
# In case the target is build for testing:
# $ docker build --target=builder -t test .
ENTRYPOINT ["/node-termination-handler/build/node-termination-handler"]
# Copy the controller-manager into a thin image
FROM mcr.microsoft.com/windows/nanoserver:${WINDOWS_VERSION}
WORKDIR /
COPY --from=builder /windows/system32/netapi32.dll /windows/system32/
COPY --from=builder /node-termination-handler/build/node-termination-handler .
COPY THIRD_PARTY_LICENSES.md .
ENTRYPOINT ["/node-termination-handler"]