-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(caddy): TLS certificates trust on all platforms
- Loading branch information
1 parent
0778dc5
commit 1247557
Showing
4 changed files
with
28 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
FROM --platform=$TARGETPLATFORM caddy:2-alpine | ||
FROM caddy:2-alpine | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ADD --chmod=500 https://caddyserver.com/api/download?os=${TARGETOS}&arch=${TARGETARCH}&p=github.com/lucaslorentz/caddy-docker-proxy/v2&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy | ||
|
||
COPY Caddyfile /etc/caddy/Caddyfile | ||
|
||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "wget", "-qO-", "http://localhost:2019/config" ] | ||
HEALTHCHECK --interval=5s --timeout=5s --start-period=5s --retries=3 CMD [ "wget", "-qO-", "http://127.0.0.1:2019/config" ] | ||
|
||
CMD ["caddy", "docker-proxy", "--caddyfile-path=/etc/caddy/Caddyfile"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --ansi never up -d --build 2>& 1> /dev/null | ||
docker compose cp proxy:/usr/bin/caddy /tmp/caddy | ||
docker compose up -d 2>/dev/null | ||
|
||
XDG_DATA_HOME=/var/lib/docker/volumes/dev_caddy_data/_data | ||
docker compose exec proxy wget -q -O- --post-data='"0.0.0.0:2019"' --header='Content-Type:application/json' 'http://127.0.0.1:2019/config/admin/listen' | ||
|
||
sudo XDG_DATA_HOME=${XDG_DATA_HOME} \ | ||
/tmp/caddy start 2&> /dev/null; \ | ||
/tmp/caddy untrust; \ | ||
/tmp/caddy trust; \ | ||
/tmp/caddy stop 2&> /dev/null; \ | ||
docker compose cp proxy:/usr/bin/caddy /tmp/caddy 2>/dev/null | ||
|
||
rm /tmp/caddy | ||
/tmp/caddy trust | ||
|
||
# ArchLinux and derivatives, see https://wiki.archlinux.org/title/Transport_Layer_Security#Add_a_certificate_to_a_trust_store | ||
if command -v trust &> /dev/null; then | ||
sudo trust anchor /usr/local/share/ca-certificates/*.crt | ||
sudo update-ca-trust | ||
fi | ||
|
||
rm -f /tmp/caddy | ||
|
||
# Copy the certificate to a stable location (to simplify mounting on all Docker platforms) | ||
sudo docker compose cp proxy:/data/caddy/pki/authorities/local/root.crt /etc/ssl/certs/Caddy.crt 2>/dev/null | ||
|
||
echo "Certificats Caddy installés avec succès !" | ||
echo "Vous pouvez désormais monter le fichier /etc/ssl/certs/Caddy.crt sur vos projets Docker." |