mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:45:48 +00:00
update docker
This commit is contained in:
parent
e83a7bfe7d
commit
6e018d3428
2 changed files with 21 additions and 17 deletions
36
Dockerfile
36
Dockerfile
|
@ -1,27 +1,31 @@
|
||||||
# Example of custom Java runtime using jlink in a multi-stage container build
|
# Example of custom Java runtime using jlink in a multi-stage container build
|
||||||
FROM gradle:jdk21 as jdk-build
|
FROM gradle:jdk21 as build
|
||||||
|
|
||||||
COPY --chown=gradle:gradle . /home/gradle/src
|
RUN mkdir /app
|
||||||
WORKDIR /home/gradle/src
|
|
||||||
RUN ls -al
|
COPY --chown=gradle:gradle . /app
|
||||||
|
WORKDIR /app
|
||||||
|
#skip test, becase testin is another
|
||||||
RUN gradle build -x test --no-daemon
|
RUN gradle build -x test --no-daemon
|
||||||
|
|
||||||
# Create a custom Java runtime
|
FROM openjdk:21-jdk-slim as builder
|
||||||
# RUN $JAVA_HOME/bin/jlink \
|
|
||||||
# --add-modules java.base \
|
|
||||||
# --strip-debug \
|
|
||||||
# --no-man-pages \
|
|
||||||
# --no-header-files \
|
|
||||||
# --compress=2 \
|
|
||||||
# --output /javaruntime
|
|
||||||
|
|
||||||
FROM openjdk:21
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=build /app/build/libs/spring-petclinic-3.4.0.jar /app/spring-petclinic.jar
|
||||||
|
RUN java -Djarmode=layertools -jar spring-petclinic.jar extract
|
||||||
|
|
||||||
|
|
||||||
|
FROM openjdk:21-jdk-slim
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
|
|
||||||
# ENV SPRING_PROFILES_ACTIVE=dev
|
COPY --from=builder app/dependencies/ ./
|
||||||
|
COPY --from=builder app/spring-boot-loader/ ./
|
||||||
|
COPY --from=builder app/snapshot-dependencies/ ./
|
||||||
|
COPY --from=builder app/application/ ./
|
||||||
|
|
||||||
COPY --from=jdk-build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar
|
ENV SPRING_PROFILES_ACTIVE=default
|
||||||
|
|
||||||
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/spring-boot-application.jar", "$JAVA_OPTS"]
|
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-Djava.security.egd=file:/dev/./urandom", "org.springframework.boot.loader.launch.JarLauncher"]
|
||||||
|
|
|
@ -8,7 +8,7 @@ services:
|
||||||
# - POSTGRES_USER=petclinic
|
# - POSTGRES_USER=petclinic
|
||||||
# - POSTGRES_DB=petclinic
|
# - POSTGRES_DB=petclinic
|
||||||
petclinic:
|
petclinic:
|
||||||
image: spring.petclinic:${CONTEINER_VESION}
|
image: spring.petclinic:${CONTAINER_VESION:-latest}
|
||||||
container_name: petclinic
|
container_name: petclinic
|
||||||
build: ./
|
build: ./
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue