-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
50 lines (45 loc) · 1.16 KB
/
docker-compose.yml
File metadata and controls
50 lines (45 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: '3'
services:
# 阶段1:临时Web服务(仅用于证书申请)
temp-web:
image: nginx:alpine
ports:
- "80:80"
volumes:
- web-root:/var/www/html
- ./nginx-init.conf:/etc/nginx/nginx.conf
- nginx-cache:/var/cache/nginx
networks:
- app-network
user: "root"
entrypoint: sh -c "mkdir -p /var/cache/nginx && chown -R nginx:nginx /var/cache/nginx && nginx -g 'daemon off;'"
restart: unless-stopped
# 阶段2:证书申请服务
certbot:
image: certbot/certbot
volumes:
- certbot-etc:/etc/letsencrypt
- web-root:/var/www/html
command: certonly --webroot --webroot-path=/var/www/html --email 362732414@qq.com --non-interactive --agree-tos --no-eff-email -d ca.chanchun.net --staging
networks:
- app-network
# 阶段3:正式Web服务
web:
build: .
ports:
- "80:80"
- "443:443"
volumes:
- certbot-etc:/etc/letsencrypt
- web-root:/var/www/html
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
- app-network
restart: unless-stopped
volumes:
web-root:
certbot-etc:
certbot-var:
nginx-cache:
networks:
app-network: