33 lines
981 B
YAML
33 lines
981 B
YAML
services:
|
||
certbot:
|
||
build: .
|
||
image: common-server-certbot:latest
|
||
# 一次性任务容器,不常驻:
|
||
# docker compose run --rm certbot certonly ... # 申请
|
||
# docker compose run --rm certbot renew # 续签
|
||
# 注意:官方镜像 ENTRYPOINT 已经是 certbot,命令里不要再写一遍 certbot。
|
||
volumes:
|
||
- certbot-webroot:/var/www/certbot
|
||
- certbot-certs:/etc/letsencrypt
|
||
- certbot-logs:/var/log/letsencrypt
|
||
networks:
|
||
- trim-default
|
||
|
||
volumes:
|
||
# 固定物理卷名,供 nginx/docker-compose.yml 以 external 方式引用。
|
||
# compose 默认会给卷名加项目名前缀,两个 compose 项目目录不同,
|
||
# 不显式指定 name 会导致两侧指向不同的卷。
|
||
certbot-webroot:
|
||
name: certbot-webroot
|
||
driver: local
|
||
certbot-certs:
|
||
name: certbot-certs
|
||
driver: local
|
||
certbot-logs:
|
||
name: certbot-logs
|
||
driver: local
|
||
|
||
networks:
|
||
trim-default:
|
||
external: true
|