Skip to content

Commit

Permalink
Create a container Registry to host images
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-p-smith committed Feb 1, 2024
1 parent 93f9edd commit e594ada
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ ORCHESTRATION_STRATEGY=openai_functions
#Speech-to-text feature
AZURE_SPEECH_SERVICE_KEY=
AZURE_SPEECH_SERVICE_REGION=
AZURE_AUTH_TYPE=rbac
AZURE_AUTH_TYPE=rbac
AZURE_CONTAINER_REGISTRY_NAME=
24 changes: 24 additions & 0 deletions infra/core/acr.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@minLength(5)
@maxLength(50)
@description('Provide a globally unique name of your Azure Container Registry')
param acrName string = 'acr${uniqueString(resourceGroup().id)}'

@description('Provide a location for the registry.')
param location string = resourceGroup().location

@description('Provide a tier of your Azure Container Registry.')
param acrSku string = 'Basic'

resource acrResource 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = {
name: acrName
location: location
sku: {
name: acrSku
}
properties: {
adminUserEnabled: true
}
}

@description('Output the login server property for later use')
output loginServer string = acrResource.properties.loginServer
13 changes: 13 additions & 0 deletions infra/deployment.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ param SpeechServiceName string = '${ResourcePrefix}-speechservice'

@description('Azure Content Safety Name')
param ContentSafetyName string = '${ResourcePrefix}-contentsafety'

@description('Azure Container Registry Name')
param RegistryName string = '${ResourcePrefix}acr'

param newGuidString string = newGuid()

@allowed([
Expand Down Expand Up @@ -906,3 +910,12 @@ module searchIndexDataContUser 'security/role.bicep' = if (authType == 'rbac' &&
principalType: 'User'
}
}

module containerRegistry 'core/acr.bicep' = {
name: RegistryName
scope: resourceGroup()
params: {
acrName: RegistryName
location: Location
}
}
87 changes: 86 additions & 1 deletion infra/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "8362420292927365599"
"templateHash": "16647406633385922905"
}
},
"parameters": {
Expand Down Expand Up @@ -319,6 +319,13 @@
"description": "Azure Content Safety Name"
}
},
"RegistryName": {
"type": "string",
"defaultValue": "[format('{0}acr', parameters('ResourcePrefix'))]",
"metadata": {
"description": "Azure Container Registry Name"
}
},
"newGuidString": {
"type": "string",
"defaultValue": "[newGuid()]"
Expand Down Expand Up @@ -2924,6 +2931,84 @@
]
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "[parameters('RegistryName')]",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"acrName": {
"value": "[parameters('RegistryName')]"
},
"location": {
"value": "[parameters('Location')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "2164522214636164829"
}
},
"parameters": {
"acrName": {
"type": "string",
"defaultValue": "[format('acr{0}', uniqueString(resourceGroup().id))]",
"minLength": 5,
"maxLength": 50,
"metadata": {
"description": "Provide a globally unique name of your Azure Container Registry"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Provide a location for the registry."
}
},
"acrSku": {
"type": "string",
"defaultValue": "Basic",
"metadata": {
"description": "Provide a tier of your Azure Container Registry."
}
}
},
"resources": [
{
"type": "Microsoft.ContainerRegistry/registries",
"apiVersion": "2023-01-01-preview",
"name": "[parameters('acrName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('acrSku')]"
},
"properties": {
"adminUserEnabled": true
}
}
],
"outputs": {
"loginServer": {
"type": "string",
"metadata": {
"description": "Output the login server property for later use"
},
"value": "[reference(resourceId('Microsoft.ContainerRegistry/registries', parameters('acrName')), '2023-01-01-preview').loginServer]"
}
}
}
}
}
]
}

0 comments on commit e594ada

Please sign in to comment.