-
Notifications
You must be signed in to change notification settings - Fork 241
/
Dockerfile
55 lines (33 loc) · 1.63 KB
/
Dockerfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# libbpf
FROM debian:bookworm as libbpf_builder
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates gcc make pkg-config libelf-dev
COPY ./ /build/ebpf_exporter
RUN make -j $(nproc) -C /build/ebpf_exporter libbpf.a && \
tar -C /build/ebpf_exporter/libbpf/dest -czf /build/libbpf.tar.gz .
# ebpf_exporter binary
FROM golang:1.23-bookworm as ebpf_exporter_builder
RUN apt-get update && \
apt-get install -y libelf-dev pci.ids
COPY --from=libbpf_builder /build/ebpf_exporter/libbpf /build/ebpf_exporter/libbpf
COPY ./ /build/ebpf_exporter
RUN make -j $(nproc) -C /build/ebpf_exporter build && \
/build/ebpf_exporter/ebpf_exporter --version
# examples
FROM debian:bookworm as examples_builder
RUN apt-get update && \
apt-get install -y clang-16 make
COPY --from=libbpf_builder /build/ebpf_exporter/libbpf /build/ebpf_exporter/libbpf
COPY ./ /build/ebpf_exporter
RUN make -j $(nproc) -C /build/ebpf_exporter/examples CC=clang-16
# ebpf_exporter release image
FROM gcr.io/distroless/static-debian11 as ebpf_exporter
COPY --from=ebpf_exporter_builder /build/ebpf_exporter/ebpf_exporter /ebpf_exporter
COPY --from=ebpf_exporter_builder /usr/share/misc/pci.ids /usr/share/misc/pci.ids
ENTRYPOINT ["/ebpf_exporter"]
# ebpf_exporter release image with examples bundled
FROM gcr.io/distroless/static-debian11 as ebpf_exporter_with_examples
COPY --from=ebpf_exporter_builder /build/ebpf_exporter/ebpf_exporter /ebpf_exporter
COPY --from=ebpf_exporter_builder /usr/share/misc/pci.ids /usr/share/misc/pci.ids
COPY --from=examples_builder /build/ebpf_exporter/examples /examples
ENTRYPOINT ["/ebpf_exporter"]