0

I want to run a python script continuously on a container instance. I could create a docker container and update my private registry, but it seems like overkill to have to make a new image every time I change the source code. I like how Azure WebApps can link to a git repo and automatically sync the source when it is updated and re-deploy the app. Is it possible to do something similar like this out of the box without making a python web app (non-flask, etc)?

I could technically run my script in flask and just have the web server do nothing (or even close the port) but this seems unnecessary.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
Pali
  • 77
  • 7

1 Answers1

1

Is it possible to do something similar like this out of the box without making a python web app (non-flask, etc)?

I am afraid there is no such out of box way to resolve this question.

Rebuilding image when the code changes is the canonical approach. Build the python script continuously with container instance is different from the Azure WebApps. We have to update the image to the docker container so that could be updated to the private registry.

Besides, if we build/deploy pythonApp with private agent, it is not wasteful at all if done right. pythonApp code should be COPY'd into your image as the final step. This means rebuilding will be very fast as all other steps will be cached. If you only have a few kB of source code changes it will only result in a single new layer of a few kB. Stopping and starting containers is also very light weight. There is nothing to worry about in following this approach.

But, for the hosted agent, it is indeed a problem. There is a user voice on Developer Community and a topic on github about it.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135