容器化freessl-acme.sh更新nginx实现https证书自动续期
来自三线的随记
先构建一个 acme.sh 基础镜像
cat <<\EOF > acme.sh.Dockerfile FROM alpine:3.15.3 RUN apk --no-cache add curl wget openssl && \ rm -rf /var/cache/apk && \ curl -s https://get.acme.sh | sh -s [email protected] WORKDIR /root/.acme.sh EOF
docker build -f acme.sh.Dockerfile -t sanxian/freessl_acme.sh_base:v1 .
到https://freessl.cn/acme-deploy 登陆并添加域名,获取token
FROM sanxian/freessl_acme.sh_base:v1 ARG acme_token="your_token" ENV acme_domain="your_domain" RUN /root/.acme.sh/acme.sh --issue -d ${acme_domain} --dns dns_dp \ --server https://acme.freessl.cn/v2/DV90/directory/${acme_token} && \ mkdir -pv /cert ENTRYPOINT ["/bin/sh", "-c", "/root/.acme.sh/acme.sh --install-cert \ -d ${acme_domain} \ --key-file /certs/${acme_domain}_key.pem \ --fullchain-file /certs/${acme_domain}_cert.pem \ --reloadcmd \"/bin/kill -s HUP 1\" && sleep infinity"]
acme.sh配置参考: https://blog.freessl.cn/acme-quick-start/
# todo