Skip to content

Commit b710f2b

Browse files
authored
Update Dockerfile to enable non-root user with cap_add
In order to run the heplify container as a non root user, and then use capabilities (cap_add) to enable promiscous mode for the heplify binary, we need to set those capabilites on the heplify binary in the image.
1 parent f4e2141 commit b710f2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docker/heplify/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ COPY . /heplify
66
WORKDIR /heplify
77
RUN CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-linkmode external -extldflags "-static -s -w"' -o heplify .
88

9-
FROM scratch
9+
FROM alpine
10+
RUN apk --no-cache add ca-certificates tzdata libcap
1011
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
1112
COPY --from=builder /heplify/heplify .
12-
CMD ["./heplify", "-h"]
13+
RUN /usr/sbin/setcap cap_net_raw,cap_net_admin=eip heplify
14+
CMD ["./heplify", "-h"]

0 commit comments

Comments
 (0)