Skip to content

Commit

Permalink
Merge pull request #1096 from jcmoraisjr/jm-setcap
Browse files Browse the repository at this point in the history
Add net bind capability to haproxy bin
  • Loading branch information
jcmoraisjr authored May 4, 2024
2 parents 7f0bcf7 + 2aefe7a commit c52386c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ FROM haproxy:2.6.16-alpine

USER root

RUN apk upgrade --no-cache && apk --no-cache add socat openssl lua5.3 lua-json4 dumb-init
RUN apk upgrade --no-cache && apk --no-cache add libcap-utils socat openssl lua5.3 lua-json4 dumb-init

COPY rootfs/ /
COPY --from=builder /src/haproxy-ingress /haproxy-ingress-controller

RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\
&& chown -R haproxy:haproxy /etc/haproxy /var/lib/haproxy /var/run/haproxy\
&& chmod 0 /var/empty
&& chmod 0 /var/empty\
&& setcap 'cap_net_bind_service=+ep' /usr/local/sbin/haproxy

STOPSIGNAL SIGTERM
USER haproxy
Expand Down
5 changes: 3 additions & 2 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ FROM haproxy:2.6.16-alpine

USER root

RUN apk upgrade --no-cache && apk --no-cache add socat openssl lua5.3 lua-json4 dumb-init
RUN apk upgrade --no-cache && apk --no-cache add libcap-utils socat openssl lua5.3 lua-json4 dumb-init

COPY . /

RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\
&& chown -R haproxy:haproxy /etc/haproxy /var/lib/haproxy /var/run/haproxy\
&& chmod 0 /var/empty
&& chmod 0 /var/empty\
&& setcap 'cap_net_bind_service=+ep' /usr/local/sbin/haproxy

STOPSIGNAL SIGTERM
USER haproxy
Expand Down

0 comments on commit c52386c

Please sign in to comment.