Skip to content

Instantly share code, notes, and snippets.

@rollendxavier
Created April 24, 2022 18:53
Show Gist options
  • Save rollendxavier/771d6a88a65d4c8df3f9ffa7dd091364 to your computer and use it in GitHub Desktop.
Save rollendxavier/771d6a88a65d4c8df3f9ffa7dd091364 to your computer and use it in GitHub Desktop.
trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
imageRepository: 'javascriptdocker'
containerRegistry: 'sampleappcontinerregistry.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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment