Spaces:
Running
Running
| # Stage 1: Build the application | |
| FROM maven:3.9.6-eclipse-temurin-17-alpine AS build | |
| WORKDIR /app | |
| # Copy only the pom.xml first to cache dependencies | |
| COPY pom.xml . | |
| RUN mvn dependency:go-offline -B | |
| # Copy the source code and build the application | |
| COPY src ./src | |
| RUN mvn clean package -DskipTests | |
| # Stage 2: Run the application | |
| FROM eclipse-temurin:17-jre-alpine | |
| WORKDIR /app | |
| # Create a non-root user for security | |
| RUN addgroup -S spring && adduser -S spring -G spring | |
| USER spring:spring | |
| # Copy the jar from the build stage | |
| # The name matches your <artifactId>-<version> from pom.xml | |
| COPY --from=build /app/target/pdf-parser-1.0.0.jar app.jar | |
| # Koyeb usually uses port 8080 by default | |
| EXPOSE 7860 | |
| ENTRYPOINT ["java", "-jar", "app.jar"] | |