Spaces:
No application file
No application file
# Stage 1: Build Spring Boot app with Maven | |
FROM maven:3.9.6-eclipse-temurin-17 AS build | |
WORKDIR /app | |
# Copy project files | |
COPY pom.xml . | |
COPY src ./src | |
# Build the Spring Boot JAR (skip tests to save time) | |
RUN mvn clean package -DskipTests | |
# Stage 2: Run the app | |
FROM openjdk:17-jdk-slim | |
WORKDIR /app | |
# Copy the JAR from the build stage | |
COPY --from=build /app/target/*.jar app.jar | |
# Hugging Face Spaces requires exposing port 7860 | |
EXPOSE 7860 | |
# Run Spring Boot on port 7860 | |
ENTRYPOINT ["java","-jar","app.jar","--server.port=7860"] | |