I'm trying to start an API in my last stage of a git CI/CD pipeline. That's done in Python through FastAPI/uvicorn, which runs inside a Docker container.
app = FastAPI()
if __name__ == '__main__':
uvicorn.run(app, port=777, host="0.0.0.0")
Everything works fine, however, there is one problem. Since the API starts and then keeps running (as it should), the CI/CD stage doesn't pass once the API has started, but it just keeps running also. Therefore the whole pipeline can never reach the passed status.
How would it be possible to mark a CI/CD stage as passed, even though the underlying Docker container (and the Python script inside it) has not terminated, because it needs to keep the API running?