Configure ACR name: zdlas
This commit is contained in:
59
azure-pipelines.yml
Normal file
59
azure-pipelines.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
# Azure DevOps Pipeline - Build and Push Docker Images
|
||||
# Dit bestand kan gebruikt worden in Azure DevOps Pipelines
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
tags:
|
||||
include:
|
||||
- 'v*'
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
variables:
|
||||
# Azure Container Registry naam - pas aan naar jouw ACR
|
||||
acrName: 'zdlas'
|
||||
repositoryName: 'zuyderland-cmdb-gui'
|
||||
dockerRegistryServiceConnection: 'zuyderland-cmdb-acr-connection' # Service connection naam in Azure DevOps
|
||||
imageTag: '$(Build.BuildId)'
|
||||
|
||||
stages:
|
||||
- stage: Build
|
||||
displayName: 'Build and Push Docker Images'
|
||||
jobs:
|
||||
- job: BuildImages
|
||||
displayName: 'Build Docker Images'
|
||||
steps:
|
||||
- task: Docker@2
|
||||
displayName: 'Build and Push Backend Image'
|
||||
inputs:
|
||||
command: buildAndPush
|
||||
repository: '$(repositoryName)/backend'
|
||||
dockerfile: 'backend/Dockerfile.prod'
|
||||
containerRegistry: '$(dockerRegistryServiceConnection)'
|
||||
tags: |
|
||||
$(imageTag)
|
||||
latest
|
||||
|
||||
- task: Docker@2
|
||||
displayName: 'Build and Push Frontend Image'
|
||||
inputs:
|
||||
command: buildAndPush
|
||||
repository: '$(repositoryName)/frontend'
|
||||
dockerfile: 'frontend/Dockerfile.prod'
|
||||
containerRegistry: '$(dockerRegistryServiceConnection)'
|
||||
tags: |
|
||||
$(imageTag)
|
||||
latest
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Output Image URLs'
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
Write-Host "##vso[task.setvariable variable=backendImage]$(acrName).azurecr.io/$(repositoryName)/backend:$(imageTag)"
|
||||
Write-Host "##vso[task.setvariable variable=frontendImage]$(acrName).azurecr.io/$(repositoryName)/frontend:$(imageTag)"
|
||||
Write-Host "Backend Image: $(backendImage)"
|
||||
Write-Host "Frontend Image: $(frontendImage)"
|
||||
Reference in New Issue
Block a user