You can instead add a main method (more specifically, if __name__ == "__main__":) inside your existing Python script (i.e., main.py in your case) or a new Python script, where you run the uvicorn server, allowing you to set parameters, such as host, port, reload, workers, etc. (as shown here), and simply execute that Python script from inside your bash script. Have a look here for all the available options.
import uvicorn
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
Edit: Since you mentioned below that you "have the script defined in the entrypoint section of docker-compose", make sure you give the exact path to the bash script, as well as it has permissions to execute. Have a look at the questions here and here. I would also suggest to take a look at the relevant FastAPI documentation.