Mostly people don’t use custom certificates anymore. I’m not sure that there is a good reason to do what you’re asking, but you can see Allow SSL / HTTPS for your Discourse Docker setup
I think you just want to turn off the orange cloud, get a lets encrypt certificate and turn on the orange cloud. You also want to use the cloudflare template.