This commit is contained in:
张威33321
2026-09-08 20:36:17 +08:00
parent 58d65188a1
commit fb87be680d
19 changed files with 398 additions and 212 deletions

View File

@@ -1,20 +1,19 @@
# Certbot 镜像 - Let's Encrypt 证书管理
FROM certbot/certbot:latest
#
# 【重要】官方 certbot/certbot 镜像的 ENTRYPOINT 是 ["certbot"],这里不要覆盖
# ENTRYPOINT 或 CMD。一旦覆盖容器启动命令会变成 `certbot <你的 CMD>`
# certbot 无法解析而退出。正确用法是把容器当一次性任务跑:
# docker compose run --rm certbot certonly ...
# docker compose run --rm certbot renew
FROM certbot/certbot:v5.8.0
LABEL maintainer="awei"
LABEL description="Let's Encrypt certificate management service"
# 安装额外工具
# 调试用工具(如需 DNS-01 验证,在此追加 pip install certbot-dns-xxx
RUN apk add --no-cache curl bash
# 创建必要目录
RUN mkdir -p /var/www/certbot /etc/letsencrypt /var/log/letsencrypt
# 设置工作目录
WORKDIR /var/www/certbot
# 暴露端口(用于 ACME 验证)
EXPOSE 80
# 默认命令:启动 web 服务器用于 ACME 验证
CMD ["sh", "-c", "while true; do echo 'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 2\r\n\r\nOK' | nc -l -p 80; done"]