-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameServerContainerInstance.bicep
73 lines (69 loc) · 1.83 KB
/
gameServerContainerInstance.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { region, ContainerVolumeData, EnvironmentVariable, Resources } from 'shared.bicep'
param managedIdentityResourceId string
param containerResources Resources = { cpu: 1, memoryInGB: 2 }
param imageName string
param environmentVariables EnvironmentVariable[]
param gameSlug string
param shouldUseVolume bool = false
param containerVolumeData ContainerVolumeData
resource GameServerContainer 'Microsoft.ContainerInstance/containerGroups@2023-05-01'= {
name: 'ci-${gameSlug}-server'
location: region
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${managedIdentityResourceId}': {}
}
}
properties: {
containers: [
{
name: '${gameSlug}container'
properties: {
volumeMounts: [
{
name: containerVolumeData.name
mountPath: '/data'
}
]
image: imageName
ports: [
{
port: 25565
protocol: 'TCP'
}
]
resources: {
requests: {
cpu: containerResources.cpu
memoryInGB: containerResources.memoryInGB
}
}
environmentVariables: environmentVariables
}
}
]
volumes: (shouldUseVolume) ? [
{
name: containerVolumeData.name
azureFile: {
readOnly: containerVolumeData.azureFile.readOnly
shareName: containerVolumeData.azureFile.shareName
storageAccountName: containerVolumeData.azureFile.storageAccountName
storageAccountKey: containerVolumeData.azureFile.storageAccountKey
}
}
] : []
osType: 'Linux'
ipAddress: {
type: 'Public'
ports: [
{
protocol: 'TCP'
port: 25565
}
]
}
restartPolicy: 'OnFailure'
}
}