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 | a150350731232dce71300c3ae407422b28351d04 (patch) | |
tree | dfd8d56a0080c8292fb6f1be8bf7f264633c361d /docker/nginx | |
parent | 9af2627390dac70faffa3a3b22ff49f77e782004 (diff) | |
download | crupest-a150350731232dce71300c3ae407422b28351d04.tar.gz crupest-a150350731232dce71300c3ae407422b28351d04.tar.bz2 crupest-a150350731232dce71300c3ae407422b28351d04.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;" |