-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathContainerfile
More file actions
35 lines (26 loc) · 798 Bytes
/
Copy pathContainerfile
File metadata and controls
35 lines (26 loc) · 798 Bytes
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
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.23
FROM golang:${GO_VERSION}-bookworm AS build
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
llvm \
libbpf-dev \
libelf-dev \
linux-libc-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETARCH
ARG VERSION=dev
ARG REVISION=unknown
RUN go generate ./...
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
go build -trimpath -ldflags "-s -w -X main.Version=${VERSION} -X main.Revision=${REVISION}" \
-o /out/copy-fail-blocker .
FROM gcr.io/distroless/static-debian12:nonroot
USER 0:0
COPY --from=build /out/copy-fail-blocker /copy-fail-blocker
ENTRYPOINT ["/copy-fail-blocker"]