Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Build Stage
FROM --platform=linux/amd64 eclipse-temurin:21
FROM eclipse-temurin:21

#
ARG JAR_FILE=target/camera-onboarding-0.0.1-SNAPSHOT.jar
ARG JAR_FILE=target/*.jar

# Set the working directory inside the container
WORKDIR /app
Expand Down
70 changes: 70 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

trigger:
- main

resources:
- repo: self

variables:
dockerRegistryServiceConnection: '4c281479-6e31-4cb5-8e58-712d66f03a90'
imageRepository: 'cameraonboarding'
containerRegistry: 'acrcameraonboarding.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
buildVersion: $[format('{0:yyyyMMdd}-{1}', pipeline.startTime, variables['Build.SourceVersion'])]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are also variable, why don't you use variables like secrets


stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
name: "Default"
steps:
- script: |
echo "Checking if Docker is running..."
docker info || (
echo "Docker is not running! Trying to start Docker..."
start-process -FilePath "C:\Program Files\Docker\Docker\Docker Desktop.exe"
)
displayName: "Ensure Docker Daemon is Running (Windows)"
continueOnError: true

- task: Maven@4
displayName: Build Maven
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '21'

- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: $(dockerRegistryServiceConnection)

- task: Docker@2
displayName: Build Docker Image
inputs:
command: build
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
arguments: "--platform linux/amd64"
tags: |
$(buildVersion)
latest

- task: Docker@2
displayName: Push Docker Image
inputs:
command: push
repository: $(imageRepository)
tags: |
$(buildVersion)
latest

Loading