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 845a7c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions 2.6/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 +30,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 +54,4 @@ EXPOSE 2019

WORKDIR /srv

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
5 changes: 3 additions & 2 deletions Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ .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 +30,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 +54,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 845a7c0

Please sign in to comment.