How do setup proxy.py server within an existing container?

Hello, glad to be here, first time support request.

I am building a plugin for an webapp (Grafana for the curious) that is running in a Docker container, defined in a docker-compose.yaml file.

In order to bypass CORS related issues where user-defined URLs are stored at an arbitrary URL, I need to setup and run proxy.py on the container running the webapp. The idea is I am planning on injecting CORS headers into incoming responses to the related requests as per my requirement. For simplicity sakes, I am requiring that all requests/responses from/to the web app should go through the proxy.

Is this something that can be defined in docker-compose.yaml or is this a use case that requires use of Dockerfile? And are there better solutions, such as running a proxp.py container instance and networking the instances together instead? Finally, how do I set it up?

Best,
Elton