Skip to content

PublishAsAzureContainerApp doesn't respect WithEntrypoint #7576

@eerhardt

Description

@eerhardt

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Trying to use a WithEntrypoint and PublishAsAzureContainerApp doesn't generate the correct command in the bicep.

Expected Behavior

WithEntrypoint translates into the ACA container command in the bicep.

Steps To Reproduce

var cache = builder.AddRedis("cache")
    .WithEntrypoint("/bin/sh")
    .WithArgs("-c", "redis-server --protected-mode $PROTECTED_MODE")
    .WithEnvironment("PROTECTED_MODE", "yes")
    .PublishAsAzureContainerApp((infra, app) =>
    {
    })
    .WithRedisInsight();

azd infra synth the above in an AppHost, you get the following bicep:

@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location

param outputs_azure_container_registry_managed_identity_id string

param outputs_managed_identity_client_id string

param outputs_azure_container_apps_environment_id string

resource cache 'Microsoft.App/containerApps@2024-03-01' = {
  name: 'cache'
  location: location
  properties: {
    configuration: {
      activeRevisionsMode: 'Single'
      ingress: {
        external: false
        targetPort: 6379
        transport: 'tcp'
      }
    }
    environmentId: outputs_azure_container_apps_environment_id
    template: {
      containers: [
        {
          image: 'docker.io/library/redis:7.4'
          name: 'cache'
          args: [
            '-c'
            'redis-server --protected-mode \$PROTECTED_MODE'
          ]
          env: [
            {
              name: '\$PROTECTED_MODE'
              value: 'yes'
            }
            {
              name: 'AZURE_CLIENT_ID'
              value: outputs_managed_identity_client_id
            }
          ]
        }
      ]
      scale: {
        minReplicas: 1
      }
    }
  }
  identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
      '${outputs_azure_container_registry_managed_identity_id}': { }
    }
  }
}

Notice that /bin/sh doesn't get set for the container command.

Exceptions (if any)

No response

.NET Version info

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using Azure

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions