-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·25 lines (21 loc) · 919 Bytes
/
Dockerfile
File metadata and controls
executable file
·25 lines (21 loc) · 919 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
FROM golang:1.25.8-alpine3.22 AS buildstage
# Accept GitHub token at build time for private repo access
ARG GHCR_PAT
ENV GOPRIVATE=github.com/kloudmate/*
ENV GONOSUMDB=github.com/kloudmate/*
RUN apk add --no-cache git make
RUN git config --global url."https://${GHCR_PAT}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
# eBPF modules are pre-generated by the CI runner and copied into the build context
COPY build-modules/km-ebpf /build/modules/km-ebpf
WORKDIR /app
COPY go.mod go.sum ./
COPY . .
ARG VERSION=dev
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -a -tags linux -ldflags "-w -s -X 'main.version=${VERSION}'" -o /kmagent ./cmd/kmagent/...
FROM gcr.io/distroless/static-debian11
COPY --from=buildstage /kmagent /kmagent
COPY ./configs/docker-col-config.yaml /config.yaml
EXPOSE 4317 4318
ENTRYPOINT ["/kmagent", "--docker-mode", "--config", "/config.yaml", "start"]