How to configure CORS headers in go-ipfs (without CLI command)

I want to build the go-ipfs Docker image such that CORS is enabled on the specified hosts.
Is there a way to configure it without using the CLI commands so that the Docker image allows CORS? Could someone show an example