An open API service indexing awesome lists of open source software.

https://github.com/score-spec/score-aca


https://github.com/score-spec/score-aca

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# score-aca

`score-aca` is a Score implementation of the [Score specification](https://github.com/score-spec/spec) for [Azure Container Apps (ACA)](https://azure.microsoft.com/products/container-apps).

## Demo

When executing the following command, the file `score.yaml` is created with the following content:

```sh
go run ./cmd/score-aca init
```

```yaml
apiVersion: score.dev/v1b1
containers:
main:
image: stefanprodan/podinfo
metadata:
name: example
service:
ports:
web:
port: 8080
```

### Generate Bicep file

To generate a Bicep file from the `score.yaml`, execute the following command:

```sh
go run ./cmd/score-aca generate score.yaml
```

The output `manifests.bicep` contains the following which indicates:

1. The environment that will hold all other resources.
2. The Azure Container App based on Container Image.

```bicep
// Generated by score-aca
// Azure Container Apps Bicep manifest

// Parameters
param environmentName string = 'example-environment'
param containerAppName string = 'example-container-app'
param location string = resourceGroup().location

// Container App Environment
resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2024-03-01' = {
name: environmentName
location: location
properties: {
appLogsConfiguration: {
destination: 'azure-monitor'
}
}
}

// Container App
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
name: containerAppName
location: location
properties: {
environmentId: containerAppEnvironment.id
configuration: {
ingress: {
external: true
targetPort: 8080
}
}
template: {
containers: [
{
name: 'main'
image: 'stefanprodan/podinfo'
}
]
}
}
}

// Outputs
output containerAppFQDN string = containerApp.properties.configuration.ingress.fqdn
```

### Deploy Container App in Azure

```sh
export LOCATION="eastus"
export RESOURCE_GROUP="rg-score-aca"

az login
# or
az login --use-device-code

az group create --name ${RESOURCE_GROUP} --location ${LOCATION}

az deployment group create --resource-group "${RESOURCE_GROUP}" --template-file ./manifests.bicep
```