35 lines
918 B
YAML
35 lines
918 B
YAML
trigger:
|
|
- main
|
|
|
|
resources:
|
|
- repo: self
|
|
|
|
variables:
|
|
# Container registry service connection established during pipeline creation
|
|
dockerRegistryServiceConnection: 'da808316-c62a-445b-ae0c-3ad87fd75a60'
|
|
imageRepository: 'javadocker'
|
|
containerRegistry: 'taskjava.azurecr.io'
|
|
dockerfilePath: '$(Build.SourcesDirectory)/app/Dockerfile'
|
|
tag: '$(Build.BuildId)'
|
|
|
|
# Agent VM image name
|
|
vmImageName: 'ubuntu-latest'
|
|
|
|
stages:
|
|
- stage: Build
|
|
displayName: Build and push stage
|
|
jobs:
|
|
- job: Build
|
|
displayName: Build
|
|
pool:
|
|
vmImage: $(vmImageName)
|
|
steps:
|
|
- task: Docker@2
|
|
displayName: Build and push an image to container registry
|
|
inputs:
|
|
command: buildAndPush
|
|
repository: $(imageRepository)
|
|
dockerfile: $(dockerfilePath)
|
|
containerRegistry: $(dockerRegistryServiceConnection)
|
|
tags: |
|
|
$(tag)
|