From 841083a729985ee0059408eb256860d53a1d7171 Mon Sep 17 00:00:00 2001 From: TomPGrid Date: Wed, 26 Feb 2025 10:45:34 +0100 Subject: [PATCH] add dockerfile --- Dockerfile | 32 +++ pom.xml | 10 +- pom.xml.releaseBackup | 461 ------------------------------------------ 3 files changed, 38 insertions(+), 465 deletions(-) create mode 100644 Dockerfile delete mode 100644 pom.xml.releaseBackup diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..21d1b5e84 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM maven AS build +WORKDIR /app +COPY pom.xml . +COPY src ./src +RUN mvn clean package -DskipTests + +RUN jar xf /app/target/spring-petclinic-3.4.0-SNAPSHOT.jar +RUN jdeps \ + --ignore-missing-deps \ + --print-module-deps \ + --multi-release 17 \ + --recursive \ + --class-path 'BOOT-INF/lib/*' \ + /app/target/spring-petclinic-3.4.0-SNAPSHOT.jar > modules.txt + +RUN $JAVA_HOME/bin/jlink \ + --add-modules $(cat modules.txt) \ + --strip-debug \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime + +FROM debian:buster-slim +ENV JAVA_HOME=/opt/java/openjdk +ENV PATH="${JAVA_HOME}/bin:${PATH}" +COPY --from=build /javaruntime $JAVA_HOME + +WORKDIR /app +COPY --from=build /app/target/spring-petclinic-3.4.0-SNAPSHOT.jar . +CMD ["java", "-Dspring.profiles.active=postgres", "-jar", "spring-petclinic-3.4.0-SNAPSHOT.jar"] + diff --git a/pom.xml b/pom.xml index 50a0b3ed5..f458705bf 100644 --- a/pom.xml +++ b/pom.xml @@ -24,12 +24,14 @@ - release-repo - file://${project.build.directory}/deploy/releases + nexus + releases + http://localhost:8081/repository/maven-releases/ - snapshot-repo - file://${project.build.directory}/deploy/snapshots + nexus + snapshots + http://localhost:8081/repository/maven-snapshots/ diff --git a/pom.xml.releaseBackup b/pom.xml.releaseBackup deleted file mode 100644 index 2be7f5bb9..000000000 --- a/pom.xml.releaseBackup +++ /dev/null @@ -1,461 +0,0 @@ - - - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 3.4.0 - - - - org.springframework.samples - spring-petclinic - 4.0.0-SNAPSHOT - - petclinic - - - scm:git:git://github.com/TomP101/spring-petclinic.git - scm:git:ssh://git@github.com/TomP101/spring-petclinic.git - https://github.com/TomP101/spring-petclinic - - - - - - 17 - UTF-8 - UTF-8 - - 2025-01-21T13:34:14Z - - - 1.0.1 - 5.3.3 - 4.7.0 - - 10.20.1 - 0.8.12 - 0.2.29 - 1.0.0 - 3.6.0 - 0.0.11 - 0.0.43 - - - - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-test - test - - - - io.projectreactor - reactor-core - - - - - com.h2database - h2 - runtime - - - com.mysql - mysql-connector-j - runtime - - - org.postgresql - postgresql - runtime - - - - - javax.cache - cache-api - - - com.github.ben-manes.caffeine - caffeine - - - - - org.webjars - webjars-locator-lite - ${webjars-locator.version} - - - org.webjars.npm - bootstrap - ${webjars-bootstrap.version} - - - org.webjars.npm - font-awesome - ${webjars-font-awesome.version} - - - - org.springframework.boot - spring-boot-devtools - test - - - org.springframework.boot - spring-boot-testcontainers - test - - - org.springframework.boot - spring-boot-docker-compose - test - - - org.testcontainers - junit-jupiter - test - - - org.testcontainers - mysql - test - - - - jakarta.xml.bind - jakarta.xml.bind-api - - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-java - - enforce - - - - - This build requires at least Java ${java.version}, - update your JVM, and - run the build again - ${java.version} - - - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - ${spring-format.version} - - - - validate - - validate - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle.version} - - - com.puppycrawl.tools - checkstyle - ${checkstyle.version} - - - io.spring.nohttp - nohttp-checkstyle - ${nohttp-checkstyle.version} - - - - - nohttp-checkstyle-validation - - check - - validate - - src/checkstyle/nohttp-checkstyle.xml - ${basedir} - **/* - **/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class - config_loc=${basedir}/src/checkstyle/ - - - - - - org.graalvm.buildtools - native-maven-plugin - - - org.springframework.boot - spring-boot-maven-plugin - - - - - build-info - - - - ${project.build.sourceEncoding} - ${project.reporting.outputEncoding} - ${java.version} - ${java.version} - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - prepare-agent - - - - report - - report - - prepare-package - - - - - - - io.github.git-commit-id - git-commit-id-maven-plugin - - false - false - - - - - - org.cyclonedx - cyclonedx-maven-plugin - - - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - - - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - - css - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - - unpack - - - generate-resources - - - - org.webjars.npm - bootstrap - ${webjars-bootstrap.version} - - - ${project.build.directory}/webjars - - - - - - - com.gitlab.haynes - libsass-maven-plugin - ${libsass.version} - - ${basedir}/src/main/scss/ - ${basedir}/src/main/resources/static/resources/css/ - ${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/ - - - - - - compile - - generate-resources - - - - - - - - m2e - - - m2e.version - - - - - - - - org.eclipse.m2e - lifecycle-mapping - ${lifecycle-mapping} - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [1,) - - check - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - [1,) - - build-info - - - - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - [0,) - - validate - - - - - - - - - - - - - - - -