diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1bbf0f70b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# Use an official Maven runtime as a parent image +FROM maven:3.8.4-openjdk-17-slim AS build + +# Set the working directory in the container +WORKDIR /app + +# Copy the compiled JAR file from the build stage +COPY target/*.jar /app/petclinic.jar + +# Specify the command to run on container start +CMD ["java", "-jar", "petclinic.jar"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 55d2b642d..adc152779 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,6 +19,14 @@ pipeline { } } + stage('Build a Docker Image') { + steps { + // Build a Docker image + script { + docker.build('petclinic:auto') + } + } + } stage ('Archive test results') { steps { //Archive the test results