benchpress/examples/ContainerApp/containerApp.bicep

70 строки
1.6 KiB
Bicep

param containerAppName string = 'acr${take(uniqueString(resourceGroup().id), 5)}'
param location string = resourceGroup().location
param targetPort int = 80
param containerImage string = 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'loganalytics${containerAppName}'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
}
resource containerAppEnv 'Microsoft.App/managedEnvironments@2022-10-01' = {
name: 'env${containerAppName}'
location: location
sku: {
name: 'Consumption'
}
properties: {
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logAnalytics.properties.customerId
sharedKey: logAnalytics.listKeys().primarySharedKey
}
}
}
}
resource containerApp 'Microsoft.App/containerApps@2022-10-01' = {
name: containerAppName
location: location
properties: {
managedEnvironmentId: containerAppEnv.id
configuration: {
ingress: {
external: true
targetPort: targetPort
allowInsecure: false
traffic: [
{
latestRevision: true
weight: 100
}
]
}
}
template: {
revisionSuffix: 'firstrevision'
containers: [
{
name: containerAppName
image: containerImage
resources: {
cpu: json('0.5')
memory: '1Gi'
}
}
]
scale: {
minReplicas: 1
maxReplicas: 3
}
}
}
}