services: web: container_name: novicelab-dev-nginx image: nginx:latest ports: - "80:80" - "443:443" volumes: - ./data/nginx.conf:/etc/nginx/nginx.conf:ro - ./data/conf.d:/etc/nginx/conf.d:ro - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot restart: always command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" networks: - nginx certbot: image: certbot/dns-cloudflare:latest restart: unless-stopped volumes: - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot - /var/run/docker.sock:/var/run/docker.sock # Allows container to talk to Docker entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" networks: - nginx networks: nginx: driver: bridge external: true