Azure/container-apps-deploy-action

Error when updating Container App without Dockerfile

willvelida opened this issue ยท 4 comments

I have a GitHub Action workflow file that provisions the resources for my container app, and then uses the GitHub Action to update the images to ones that are generated by the GitHub Action.

I've set up my Container Apps deploy action like so:

- name: Build and Deploy Backend Container App
        uses: azure/container-apps-deploy-action@v0
        with:
          appSourcePath: ${{ github.workspace }}/src/MyFrontEnd/MyFrontEnd
          acrName: ${{ steps.getacrname.outputs.acrName }}
          acrUsername: ${{ steps.getacrcreds.outputs.loginName }}
          acrPassword: ${{ steps.getacrcreds.outputs.password }}
          containerAppName: myfrontend
          resourceGroup: ${{ secrets.AZURE_RG}} 

I have no Dockerfiles in my C# projects and looking at the runner logs, the image is being built successfully, but the action fails with the following error:

Error response from daemon: unexpected error reading Dockerfile: read /var/lib/docker/tmp/docker-builder805887875: is a directory

Is one of the following happening?

  • Is the Container Apps Deploy Action pulling down Oryx images correctly?
  • Is this an error from Oryx itself? (and should I raise an issue there?)
  • Am I just being stupid and I have to supply a Dockerfile for each of my projects?

@willvelida Hey Will, sorry for the delayed response -- I just merged a pull request that fixes this issue. An environment variable we used for the provided/found Dockerfile path was always being assigned to some value, regardless of if a Dockerfile exists in the application source. By default, it was being set to the application source's root, but was never updated (since no Dockerfile was provided/found), so when we got to the docker build step, it would try to build this "file" (which was a directory, hence the error you see above) and failed immediately. This logic was updated to keep this environment variable empty in the case where no Dockerfile is found/provided.

The change is currently in our main branch, so you can feel free to target that branch rather than the v0 tag when using this action while we work to get out a v0.1 release of this action with some additional changes. Thanks!

Thanks for the reply and the fix @cormacpayne! I'll update my build file ๐Ÿ˜Š

I'm using @main and I don't think this is fixed. See https://github.com/timheuer/WebApplication279/actions/runs/3624859762/jobs/6112279696#step:7:74 -- it seems that is being hit still setting this but the repo has no Dockerfile (https://github.com/Azure/container-apps-deploy-action/blob/main/action.yml#L146)

@timheuer Hey Tim, sorry for the delayed response -- taking a look at the logs you provided, the line you linked in the action.yml is being hit, but the CA_GH_ACTION_DOCKERFILE_PATH environment variable isn't being set since the Dockerfile path we constructed with dockerfilePath doesn't exist, so the action proceeds to use our builder to produce a runnable application image.

The error that I'm seeing in the logs occurs during the call to az containerapp up (the Azure CLI command used to create/update the Container App):

ERROR: Operation returned an invalid status 'Forbidden'

Unfortunately, this error from the CLI command isn't clear as to what operation you're forbidden from performing; in this case, I would verify that the credential you created and set to AZURE_CREDENTIALS in your secret store has at least contributor access to the subscription that you're creating the Container App in, or if you decide to provide a resource group as an argument to the action, that the credential has at least contributor access to that resource group.