spring-petclinic/.devcontainer/Dockerfile
lamya1baidouri 823f41c08d fix syntax
2025-02-03 15:09:34 +01:00

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"]