Skip to content

Instantly share code, notes, and snippets.

@j-tim
Created October 26, 2020 14:45
Show Gist options
  • Save j-tim/9939c880d660793bb3a7badf4a774bf2 to your computer and use it in GitHub Desktop.
Save j-tim/9939c880d660793bb3a7badf4a774bf2 to your computer and use it in GitHub Desktop.
Azure Pipeline to build and push OCI (Docker) image
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- task: Maven@3
displayName: Build Docker image
inputs:
mavenPomFile: 'pom.xml'
goals: 'spring-boot:build-image'
publishJUnitResults: false
jdkVersionOption: '1.11'
- task: Docker@2
displayName: Push Docker image
inputs:
containerRegistry: 'timscontainerregistry'
repository: 'spring-boot-example'
command: 'push'
tags: 'latest'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment