Created
October 1, 2025 16:06
-
-
Save dalthonmh/a1f8c15ba0c98dfb29a90e26d74c7e14 to your computer and use it in GitHub Desktop.
Pipeline para buildeo automático de imagen Java en Azure Pipelines en Azure DevOps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 | |
| # by: [email protected] | |
| trigger: | |
| - main | |
| variables: | |
| dockerRegistryServiceConnection: "" | |
| imageRepository: "billing" | |
| containerRegistry: "dalthonmhbilling.azurecr.io" | |
| dockerfilePath: "$(Build.SourcesDirectory)/Dockerfile" | |
| buildConfiguration: "Release" | |
| MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository | |
| MAVEN_OPTS: "-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)" | |
| stages: | |
| - stage: Build | |
| displayName: "Build application" | |
| jobs: | |
| - job: Build | |
| pool: | |
| vmImage: ubuntu-latest | |
| steps: | |
| - task: Cache@2 | |
| displayName: Cache Maven packages | |
| inputs: | |
| key: 'maven | "$(Agent.OS)" | **/pom.xml' | |
| restoreKeys: | | |
| maven | "$(Agent.OS)" | |
| maven | |
| path: $(MAVEN_CACHE_FOLDER) | |
| - task: Maven@4 | |
| displayName: "Maven Package" | |
| inputs: | |
| mavenPomFile: "pom.xml" | |
| mavenOptions: "-Xmx3072m" | |
| javaHomeOption: "JDKVersion" | |
| jdkVersionOption: "1.11" | |
| jdkArchitectureOption: "x64" | |
| publishJUnitResults: true | |
| testResultsFiles: "**/surefire-reports/TEST-*.xml" | |
| mavenAuthenticateFeed: true | |
| goals: "package" | |
| options: "-X -P azure_artifacts $(MAVEN_OPTS)" | |
| - task: Docker@2 | |
| displayName: "Build and push image" | |
| inputs: | |
| command: buildAndPush | |
| repository: $(imageRepository) | |
| dockerfile: $(dockerfilePath) | |
| containerRegistry: $(dockerRegistryServiceConnection) | |
| tags: | | |
| $(Build.BuildId) | |
| latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment