Is there an easy way to add a robots.txt to a tutor-based OpenEdX deployment?

Talking with my colleague who knows more about Caddy, I realised it should be possible to do with this instead, which does not require adding a file to the caddy container

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "caddyfile-cms",
        """
# Serve robots.txt
respond /robots.txt 200 {
    body "User-agent: *
Disallow: /"
    close
}
        """
    )
) 

hooks.Filters.ENV_PATCHES.add_item(
    (
        "caddyfile-lms",
        """
# Serve robots.txt
respond /robots.txt 200 {
    body "User-agent: *
Disallow: /"
    close
}
        """
    )
)

I did not implement this since I’ve implemented in the outside caddy server instead, but that could be of use to someone, so dropping it here anyway.