added the docker file

This commit is contained in:
chandu54321 2024-12-13 07:34:38 +05:30
parent 88a72438a5
commit dad57dbd64
2 changed files with 23 additions and 0 deletions

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM maven:3.9-eclipse-temurin-17 AS builder
# build the java code
COPY . /spc
WORKDIR /spc
RUN mvn package
# this will create a spring petclinic jar file
FROM eclipse-temurin:17-jre AS runner
COPY --from=builder --chown=ubuntu /spc/target/spring-petclinic-3.3.0-SNAPSHOT.jar /app/spring-petclinic.jar
USER ubuntu
WORKDIR /app
EXPOSE 8080
CMD ["java", "-jar", "spring-petclinic.jar"]

View file

@ -51,3 +51,12 @@ steps:
inputs: inputs:
pollingTimeoutSec: '300' pollingTimeoutSec: '300'
displayName: 'Publish Quality Gate Result' displayName: 'Publish Quality Gate Result'
- task: Docker@2
inputs:
containerRegistry: 'DOCKER_HUB'
repository: 'kasinenichandu/spring-petclinic'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: '$(Build.BuildId)'