I have an azure webapp based on a docker image that implements an image processing API and is expensive to leave active 24/7. I'm wondering if there's an easy-to-manage way to auto-scale from 0 to 1 instances when we need it, and auto-shutdown after some period of inactivity. AKS seems like one option but maybe it's overkill?
I also considered azure functions but since we're using a custom docker image it wasn't clear to me if I can provision an on-demand instance.
The API app runs in the background to respond to requests from a thin Flask app, and the Flask app has a background Celery task thread, so I could take on the task of toggling API availability from the Celery thread. This seems doable but also feels a lot like I'm reinventing the wheel.
Is there a better approach?