Skip to content

Commit

Permalink
Install libcap and run setcap cap_net_bind_service=+ep on caddy binary
Browse files Browse the repository at this point in the history
Mitigates caddyserver#104
  • Loading branch information
abjugard committed Jan 21, 2023
1 parent 579fe03 commit 159cb29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions 2.6/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM alpine:3.16

RUN apk add --no-cache ca-certificates mailcap
RUN apk add --no-cache \
ca-certificates \
libcap \
mailcap

RUN set -eux; \
mkdir -p \
Expand Down Expand Up @@ -30,6 +33,7 @@ RUN set -eux; \
echo "$checksum /tmp/caddy.tar.gz" | sha512sum -c; \
tar x -z -f /tmp/caddy.tar.gz -C /usr/bin caddy; \
rm -f /tmp/caddy.tar.gz; \
setcap cap_net_bind_service=+ep /usr/bin/caddy; \
chmod +x /usr/bin/caddy; \
caddy version

Expand All @@ -53,4 +57,4 @@ EXPOSE 2019

WORKDIR /srv

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
8 changes: 6 additions & 2 deletions Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{ .base | strings.TrimSpace }}

RUN apk add --no-cache ca-certificates mailcap
RUN apk add --no-cache \
ca-certificates \
libcap \
mailcap

RUN set -eux; \
mkdir -p \
Expand Down Expand Up @@ -30,6 +33,7 @@ RUN set -eux; \
echo "$checksum /tmp/caddy.tar.gz" | sha512sum -c; \
tar x -z -f /tmp/caddy.tar.gz -C /usr/bin caddy; \
rm -f /tmp/caddy.tar.gz; \
setcap cap_net_bind_service=+ep /usr/bin/caddy; \
chmod +x /usr/bin/caddy; \
caddy version

Expand All @@ -53,4 +57,4 @@ EXPOSE 2019

WORKDIR /srv

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]

0 comments on commit 159cb29

Please sign in to comment.