forked from spring-projects/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68f4856
commit 2bef928
Showing
1 changed file
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
# Stage 1: Build stage | ||
FROM eclipse-temurin:21-jdk-jammy as base | ||
RUN apt-get update && apt-get install -y dos2unix | ||
|
||
WORKDIR /app | ||
|
||
COPY .mvn/ .mvn | ||
COPY mvnw pom.xml ./ | ||
RUN dos2unix mvnw pom.xml | ||
RUN apt-get update && apt-get install -y dos2unix | ||
RUN dos2unix ./mvnw | ||
RUN ./mvnw dependency:resolve | ||
COPY src ./src | ||
|
||
# Stage 2: Development stage | ||
FROM base as development | ||
|
||
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.profiles=mysql", "-Dspring-boot.run.jvmArguments='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000'"] | ||
|
||
# Stage 3: Build stage | ||
FROM base as build | ||
|
||
RUN ./mvnw package | ||
|
||
# Stage 4: Production stage | ||
FROM eclipse-temurin:21-jre-jammy as production | ||
EXPOSE 8080 | ||
COPY --from=0 /app/target/dependency* /app/lib | ||
COPY --from=0 /app/target/classes /app | ||
|
||
WORKDIR /app | ||
EXPOSE 8080 | ||
CMD ["./mvnw", "spring-boot:run"] | ||
COPY --from=build /app/target/spring-petclinic-*.jar /spring-petclinic.jar | ||
|
||
CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/spring-petclinic.jar"] |