mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-24 03:59:38 +00:00
Changed dockerfile
This commit is contained in:
parent
ce2720f620
commit
47630fc538
1 changed files with 12 additions and 8 deletions
20
Dockerfile
20
Dockerfile
|
@ -1,9 +1,13 @@
|
||||||
FROM eclipse-temurin:17-jdk-alpine@sha256:b16e661d76d3af0d226d0585063dbcafe7fb8a4ef31cfcaaec71d39c41269420
|
# Use a Maven image with JDK 17 for the build stage
|
||||||
RUN apk add --no-cache iproute2
|
FROM maven:3.9.4-eclipse-temurin-17-alpine AS build
|
||||||
RUN mkdir /app
|
|
||||||
RUN addgroup --system javauser && adduser -S -s /bin/false -G javauser javauser
|
|
||||||
COPY ./target/*.jar /app/java-application.jar
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN chown -R javauser:javauser /app
|
COPY pom.xml .
|
||||||
USER javauser
|
RUN mvn dependency:go-offline -B
|
||||||
CMD ["java", "-jar", "java-application.jar"]
|
COPY . .
|
||||||
|
RUN mvn clean package -DskipTests
|
||||||
|
|
||||||
|
# Use JDK 17 for the runtime stage
|
||||||
|
FROM eclipse-temurin:17-jdk-alpine AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/target/spring-petclinic-*.jar /app/app.jar
|
||||||
|
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
|
Loading…
Reference in a new issue