I had a requirement where I wanted to run a timely job. Thought of using an
Azure Function, but due to the complexity of the job, moved ahead with an
ASP.NET Core Worker Service.
Once the dev work is done, wanted to run this on Azure and set up the DevOps side of it. Azure Container Instances (ACI) is the ideal service to run an ASP.NET Core Worker Service in
Azure and setting up CI/CD was pretty simple. CI part is just creating a
docker image and getting it pushed to an ACR (Azure Container Registry) or where ever you want to. In my scenario, I had the Docker image pushed to an ACR. A very nice thing with ACR to note: there is this option under Repositories -> Images, where you can run any
Docker image as an instance on ACI from the portal itself.
Run instance on ACI |
az container create -g <ResourceGroup> `
--name nzmiq-monitor-worker-instance `
--image myacr.azurecr.io/nzmiqmonitor/worker:$(Build.BuildId) `
--cpu 1 `
--memory 1.5 `
--registry-login-server myacr.azurecr.io `
--registry-username <RegistryUsername> `
--registry-password <RegistryPassword>
Here the $(Build.BuildId) is taken from the Build pipeline.
Isn't it nice?
Regards,
Jaliya
No comments:
Post a Comment