Search code examples
azureazure-container-apps

Is it possible to create one-off (run to completion) jobs in Azure Container Apps?


We have a job for running our DB migrations, that I would like to run on Azure Container Apps (it runs on Azure Container Instances now). The idea is that whenever we create a new migration, this job gets built and deployed, and then it triggers the migrations to run. Once the migrations have run, the job should just exit, and not get restarted. I haven't been able to find any information on how to create such a job in Azure Container Apps, except maybe it can be done in some clever way using the KEDA Cron scaler: https://keda.sh/docs/2.7/scalers/cron/

I am looking for any advice on how this can be achieved, or if this is just a bad idea for Azure Container Apps?

Thanks a lot!


Solution

  • Container apps now supports Jobs:

    In you case, you could use a manual job:

    Manual jobs are triggered on-demand using the Azure CLI or a request to the Azure Resource Manager API.

    Manual jobs can be invoked using Az CLI, ARM/Bicep or from the portal.

    Example using Az CLI:

    az containerapp job create `
      --trigger-type "Manual" `
      ...