diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-02-21 00:36:11 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-02-21 00:58:57 +0800 |
commit | da756422d9734d1d704e0cbcd248c17c30cd4f90 (patch) | |
tree | 7f2674c3a03e9cdd2b9624a8bc6b0479a1072f56 /docker/nginx | |
parent | ce16f3f4f3cec88335c49ab16f636efb5d2db2d6 (diff) | |
download | crupest-da756422d9734d1d704e0cbcd248c17c30cd4f90.tar.gz crupest-da756422d9734d1d704e0cbcd248c17c30cd4f90.tar.bz2 crupest-da756422d9734d1d704e0cbcd248c17c30cd4f90.zip |
feat(nginx): move certbot to nginx.
Diffstat (limited to 'docker/nginx')
-rw-r--r-- | docker/nginx/Dockerfile | 3 | ||||
-rw-r--r-- | docker/nginx/certbot.bash | 9 | ||||
-rw-r--r-- | docker/nginx/nginx-wrapper.bash | 7 |
3 files changed, 19 insertions, 0 deletions
diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index 86052b9..67d41d1 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -7,3 +7,6 @@ RUN pnpm install --frozen-lockfile && pnpm run build FROM nginx:mainline COPY --from=build-www /sites/www/dist /srv/www ADD sites/www/favicon.ico /srv/www/favicon.ico +RUN apt update && apt-get install -y tini certbot && rm -rf /var/lib/apt/lists/* +ADD --chmod=755 certbot.bash nginx-wrapper.bash /app/ +CMD ["/usr/bin/tini", "--", "/app/nginx-wrapper.bash"] diff --git a/docker/nginx/certbot.bash b/docker/nginx/certbot.bash new file mode 100644 index 0000000..0b8e3b7 --- /dev/null +++ b/docker/nginx/certbot.bash @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +set -e + +while true; do + certbot renew --deploy-hook "nginx -s reload" + echo "Sleep one day before next certbot renew." + sleep 1d +done diff --git a/docker/nginx/nginx-wrapper.bash b/docker/nginx/nginx-wrapper.bash new file mode 100644 index 0000000..bd566aa --- /dev/null +++ b/docker/nginx/nginx-wrapper.bash @@ -0,0 +1,7 @@ +#!/usr/bin/bash + +set -e + +/app/certbot.bash & + +nginx "-g" "daemon off;" |