ab1d9c2ad2
Merge remote-tracking branch 'certman/master'
30 lines
642 B
Docker
30 lines
642 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.26-alpine3.23 AS build
|
|
|
|
WORKDIR /workspace
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 \
|
|
GOOS=$TARGETOS \
|
|
GOARCH=$TARGETARCH \
|
|
go build -trimpath -o /out/webhook -ldflags='-s -w' .
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=build /out/webhook /usr/local/bin/webhook
|
|
|
|
ENTRYPOINT ["/usr/local/bin/webhook"]
|