docker-containers/nginx_certbot.yml

27 lines
811 B
YAML
Raw Normal View History

2023-04-04 17:05:31 +08:00
version: '3'
services:
webserver:
image: nginx:latest
container_name: nginx
ports:
- 80:80
- 443:443
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
restart: unless-stopped
volumes:
- /opt/nginx/conf/:/etc/nginx/conf.d/:ro
- /opt/nginx/certbot/www:/var/www/certbot/
- /opt/nginx/certbot/conf:/etc/nginx/ssl/
- /opt/nginx/certbot/conf:/etc/letsencrypt/
certbot:
image: certbot/certbot:latest
container_name: certbot
volumes:
- /opt/nginx/certbot/www:/var/www/certbot/:rw
- /opt/nginx/certbot/conf:/etc/letsencrypt/:rw
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
default:
name: webserver