From 4ad3c5ce9acbf48dc46ff16004a698913b9c26b2 Mon Sep 17 00:00:00 2001 From: Nicholas Mucks Date: Sun, 28 Jul 2024 16:24:15 -0700 Subject: [PATCH] fix: align jenkins volume to all of the other volumes --- Dockerfile | 35 ++++++++++++++++++++++++----- docker-compose_spring-petclinic.yml | 30 ++++++++++++------------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce19ac4ef..bb5e5f0cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,37 @@ +## Use an official OpenJDK runtime as a parent image +#FROM openjdk:11-jdk-slim +# +## Set the working directory inside the container +#WORKDIR /app +# +## Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) +#COPY target/*.jar app.jar +# +## Run the jar file +#CMD ["java", "-jar", "app.jar"] +# +## Expose the port the app runs on +#EXPOSE 8080 + # Use an official OpenJDK runtime as a parent image -FROM openjdk:11-jdk-slim +FROM openjdk # Set the working directory inside the container WORKDIR /app -# Copy the JAR file to the app directory (adjust this path according to your actual JAR file name in the target directory) -COPY target/*.jar app.jar +# Copy the Maven wrapper and the pom.xml file +COPY .mvn/ .mvn +COPY mvnw pom.xml ./ + +# Copy the project source code +COPY src ./src + +# Package the application +RUN ./mvnw clean package + + +# Copy the JAR file to the app directory +RUN cp /app/target/*.jar app.jar # Run the jar file CMD ["java", "-jar", "app.jar"] - -# Expose the port the app runs on -EXPOSE 8080 diff --git a/docker-compose_spring-petclinic.yml b/docker-compose_spring-petclinic.yml index cbad04772..1fc83ea63 100644 --- a/docker-compose_spring-petclinic.yml +++ b/docker-compose_spring-petclinic.yml @@ -49,7 +49,7 @@ services: - JAVA_OPTS=-Djenkins.install.runSetupWizard=false - CASC_JENKINS_CONFIG=/var/jenkins_home/casc_configs/jenkins.yaml volumes: - - jenkins_data:/var/jenkins_home + - ./jenkins_data:/var/jenkins_home - ./jenkins.yaml:/var/jenkins_home/casc_configs/jenkins.yaml - /var/run/docker.sock:/var/run/docker.sock networks: @@ -98,20 +98,20 @@ services: - sonarscanner: - image: sonarsource/sonar-scanner-cli - - # need this for macOS Apple M1 -# platform: linux/amd64 - networks: - - custom-network - volumes: - - ./:/usr/src - environment: - - SONAR_HOST_URL=http://sonarqube:9000/ - - SONAR_TOKEN=$MY_SONAR_TOKEN - depends_on: - - sonarqube +# sonarscanner: +# image: sonarsource/sonar-scanner-cli +# +# # need this for macOS Apple M1 +## platform: linux/amd64 +# networks: +# - custom-network +# volumes: +# - ./:/usr/src +# environment: +# - SONAR_HOST_URL=http://sonarqube:9000/ +# - SONAR_TOKEN=$MY_SONAR_TOKEN +# depends_on: +# - sonarqube volumes: prometheus_data: