mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-24 19:32:48 +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
|
||||
RUN apk add --no-cache iproute2
|
||||
RUN mkdir /app
|
||||
RUN addgroup --system javauser && adduser -S -s /bin/false -G javauser javauser
|
||||
COPY ./target/*.jar /app/java-application.jar
|
||||
# Use a Maven image with JDK 17 for the build stage
|
||||
FROM maven:3.9.4-eclipse-temurin-17-alpine AS build
|
||||
WORKDIR /app
|
||||
RUN chown -R javauser:javauser /app
|
||||
USER javauser
|
||||
CMD ["java", "-jar", "java-application.jar"]
|
||||
COPY pom.xml .
|
||||
RUN mvn dependency:go-offline -B
|
||||
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