From c1cedb32f8752aa3c1086366b9bff844e2e916a4 Mon Sep 17 00:00:00 2001 From: Dmitry Sergeev Date: Tue, 4 Jun 2024 19:13:00 +0400 Subject: [PATCH] Add cap_net_raw --- Dockerfile_custom | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile_custom b/Dockerfile_custom index 1f1609d..638e55c 100644 --- a/Dockerfile_custom +++ b/Dockerfile_custom @@ -4,12 +4,14 @@ WORKDIR /go/ping_exporter RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -a -installsuffix cgo -o /go/bin/ping_exporter -FROM docker.io/alpine:3.20.0 as certificates -RUN apk --no-cache add ca-certificates +FROM docker.io/alpine:3.20.0 as settings +RUN apk --no-cache add ca-certificates libcap +COPY --from=builder /go/bin/ping_exporter /ping_exporter +RUN setcap cap_net_raw+ep /ping_exporter FROM scratch -WORKDIR /app -COPY --from=certificates /etc/ssl /etc/ssl -COPY --from=builder /go/bin/ping_exporter /app/ping_exporter +WORKDIR / +COPY --from=settings /etc/ssl /etc/ssl +COPY --from=settings /ping_exporter /ping_exporter -ENTRYPOINT ["/app/ping_exporter"] +ENTRYPOINT ["/ping_exporter"]