-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
48 lines (43 loc) · 1.87 KB
/
docker-compose.yml
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
version: "3"
services:
back:
image: cogeu/secret
volumes:
- /home/ubuntu/MA7/logs:/logs
expose:
- 3000 # 컨테이너 포트만 열어줌 호스트는 X = 컨테이너 끼리만 접근 가능
env_file:
- ./.env
redis:
image: redis:7.2.5
volumes:
- /home/ubuntu/MA7/redis:/usr/local/etc/redis
env_file:
- ./.env
command: sh -c "redis-server /usr/local/etc/redis/redis.conf"
expose:
- 6379 # 컨테이너 내부 포트만 열어줌 호스트는 X
restart: always
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- /home/ubuntu/MA7/certbot/www:/var/www/certbot
- /home/ubuntu/MA7/certbot/conf:/etc/letsencrypt
- /home/ubuntu/MA7/nginx/nginx.conf:/etc/nginx/nginx.conf:ro # 해당 경로에 conf 파일 잘 넣어 둘 것. ro는 read only
- /home/ubuntu/MA7/nginx/log:/var/log/nginx
restart: always
certbot:
depends_on:
- nginx
image: certbot/certbot:latest
volumes:
- /home/ubuntu/MA7/certbot/www:/var/www/certbot
- /home/ubuntu/MA7/certbot/conf:/etc/letsencrypt
- /home/ubuntu/MA7/certbot/log:/var/log/letsencrypt
# 실제 서비스용 인증 발급
entrypoint: "/bin/sh -c 'trap exit TERM; if [ ! -e /etc/letsencrypt/live/도메인.com/fullchain.pem ]; then certbot certonly --webroot --webroot-path=/var/www/certbot -d 도메인.com --email [email protected] --agree-tos --no-eff-email; fi; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
# 테스트용 인증 발급
# entrypoint: "/bin/sh -c 'trap exit TERM; if [ ! -e /etc/letsencrypt/live/도메인.com/fullchain.pem ]; then certbot certonly --staging --webroot --webroot-path=/var/www/certbot -d 도메인.com --email [email protected] --agree-tos --no-eff-email; fi; while :; do certbot renew --staging; sleep 12h & wait $${!}; done;'"