Skip to content

Commit

Permalink
Install libcap and run setcap cap_net_bind_service=+eip on caddy bi…
Browse files Browse the repository at this point in the history
…nary

Mitigates caddyserver#104
  • Loading branch information
abjugard committed Jan 18, 2023
1 parent ffa8b84 commit 514bd52
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 \
mailcap \
libcap

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 \
mailcap \
libcap

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 514bd52

Please sign in to comment.