services:
  certbot:
    image: certbot/dns-cloudflare
    volumes:
      - ./certs:/etc/letsencrypt
      - ./cloudflare.ini:/root/cloudflare.ini
    command: >-
      certonly --dns-cloudflare
      --dns-cloudflare-credentials /root/cloudflare.ini
      --dns-cloudflare-propagation-seconds 15
      --email your@email.com
      --agree-tos --no-eff-email
      -d *.jimsgarage.co.uk

  nginx:
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"
    restart: "always"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "10"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./certs:/etc/letsencrypt
    networks:
      - nginx-proxy

networks:
  nginx-proxy:
    external: true