docker-compose.fragment.sh 710 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/sh
  2. cat <<EOF
  3. certbot:
  4. image: certbot/certbot
  5. EOF
  6. # If the user wants a nginx docker container
  7. if echo "${DOCKER}" | grep -Fvq '"nginx"'; then
  8. cat <<EOF
  9. depends_on:
  10. - nginx
  11. EOF
  12. fi
  13. cat <<EOF
  14. # Check for certificate renewal every 12h as
  15. # recommended by Let's Encrypt
  16. entrypoint: /bin/sh -c 'trap exit TERM;
  17. while :; do
  18. certbot renew > /dev/null;
  19. sleep 12h & wait \$\${!};
  20. done'
  21. volumes:
  22. - ./docker/certbot/www:/var/www/certbot
  23. - ./docker/certbot/.files:/etc/letsencrypt
  24. EOF