forked from projectcontour/contour
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (31 loc) · 844 Bytes
/
Dockerfile
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
31
32
33
34
35
36
37
38
ARG BUILDPLATFORM=linux/amd64
ARG BUILD_BASE_IMAGE
FROM --platform=$BUILDPLATFORM $BUILD_BASE_IMAGE AS build
WORKDIR /contour
ENV GOPROXY=https://proxy.golang.org
COPY go.mod go.sum /contour/
RUN go mod download
COPY cmd cmd
COPY internal internal
COPY pkg pkg
COPY apis apis
COPY Makefile Makefile
ARG BUILD_BRANCH
ARG BUILD_SHA
ARG BUILD_VERSION
ARG BUILD_CGO_ENABLED
ARG BUILD_EXTRA_GO_LDFLAGS
ARG TARGETOS
ARG TARGETARCH
RUN make build \
CGO_ENABLED=${BUILD_CGO_ENABLED} \
EXTRA_GO_LDFLAGS="${BUILD_EXTRA_GO_LDFLAGS}" \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
BUILD_VERSION=${BUILD_VERSION} \
BUILD_SHA=${BUILD_SHA} \
BUILD_BRANCH=${BUILD_BRANCH}
# Ensure we produced a static binary.
RUN ldd contour | grep 'not a dynamic executable'
FROM scratch AS final
COPY --from=build /contour/contour /bin/contour