-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (25 loc) · 1.42 KB
/
Copy pathDockerfile
File metadata and controls
31 lines (25 loc) · 1.42 KB
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
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2026 The hook-gitplugin Authors
# ── build stage ────────────────────────────────────────────────────────────────
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS build
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
WORKDIR /src
RUN apk add --no-cache ca-certificates git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -ldflags="-s -w" -o /out/plugin ./cmd/plugin
# ── distroless release image ───────────────────────────────────────────────────
FROM gcr.io/distroless/static-debian12:nonroot
# NOTE: intentionally no repo-specific `org.opencontainers.image.*` LABEL block
# here. sync-template.yml only substitutes the "hook-gitplugin Authors" line
# in this file when propagating it to plugin repos (see `sed` step) — it does
# NOT rewrite LABEL title/description/source values. Adding those here would
# get copied verbatim (and wrongly) into every plugin's Dockerfile. Add labels
# in each plugin's own Dockerfile after copying this template, not here.
COPY --from=build /out/plugin /usr/local/bin/plugin
USER nonroot
ENTRYPOINT ["/usr/local/bin/plugin"]