19 lines
640 B
Docker
19 lines
640 B
Docker
# Spring PetClinic: build the jar with Maven, run it on a slim JRE.
|
|
|
|
# Plain Maven, not ./mvnw: the Maven wrapper jar is not committed.
|
|
FROM maven:3.9-eclipse-temurin-17 AS build
|
|
WORKDIR /src
|
|
COPY pom.xml .
|
|
RUN mvn -B -q dependency:go-offline
|
|
COPY src ./src
|
|
# Tests run in integration-test.yml. Format and checkstyle checks gate on style, not on a working image.
|
|
RUN mvn -B -q package -DskipTests -Dspring-javaformat.skip=true -Dcheckstyle.skip=true
|
|
|
|
FROM eclipse-temurin:17-jre
|
|
WORKDIR /app
|
|
COPY --from=build /src/target/*.jar app.jar
|
|
RUN useradd --system --uid 10001 app
|
|
USER 10001
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
|