mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-01-08 19:31:12 +00:00
31 lines
602 B
Docker
31 lines
602 B
Docker
# Build stage
|
|
FROM registry.access.redhat.com/ubi8/openjdk-17:latest as builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy Maven wrapper and POM
|
|
COPY .mvn/ .mvn/
|
|
COPY mvnw pom.xml ./
|
|
|
|
# Download dependencies
|
|
RUN ./mvnw dependency:go-offline
|
|
|
|
# Copy source code
|
|
COPY src ./src
|
|
|
|
# Build the application
|
|
RUN ./mvnw package -DskipTests
|
|
|
|
# Run stage
|
|
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the built artifact from builder stage
|
|
COPY --from=builder /app/target/*.jar app.jar
|
|
|
|
# Container runs on port 8080
|
|
EXPOSE 8080
|
|
|
|
# Set the startup command
|
|
ENTRYPOINT ["java", "-jar", "app.jar"]
|