forked from bwolf/cert-manager-webhook-gandi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
23 lines (17 loc) · 736 Bytes
/
Dockerfile
File metadata and controls
23 lines (17 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# syntax=docker/dockerfile:1.3
ARG GO_VERSION
FROM --platform=${TARGETPLATFORM} golang:${GO_VERSION}-alpine AS base
WORKDIR /go/src/cert-manager-webhook-gandi
COPY go.* .
RUN --mount=type=cache,target=/go/pkg/mod \
apk add --no-cache git ca-certificates && \
go mod download
FROM base AS build
ARG TARGETOS
ARG TARGETARCH
RUN --mount=readonly,target=. --mount=type=cache,target=/go/pkg/mod \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -a -o /go/bin/webhook -ldflags '-w -extldflags "-static"' .
FROM scratch AS image
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/bin/webhook /usr/local/bin/webhook
ENTRYPOINT ["/usr/local/bin/webhook"]