blackopsrepl's picture
.
f568829
raw
history blame contribute delete
868 Bytes
# Build stage
FROM eclipse-temurin:21-jdk-alpine AS build
# Install Maven
RUN apk add --no-cache maven
# Set working directory
WORKDIR /app
# Copy source files
COPY pom.xml .
COPY src ./src
# Build the application
RUN mvn package -DskipTests -Dquarkus.package.jar.type=uber-jar
# Runtime stage
FROM eclipse-temurin:21-jre-alpine
# Create non-root user for HuggingFace Spaces
RUN addgroup -g 1000 appgroup && \
adduser -u 1000 -G appgroup -h /app -D appuser
WORKDIR /app
# Copy the built jar from build stage
COPY --from=build /app/target/*-runner.jar /app/app.jar
# Change ownership to non-root user
RUN chown -R appuser:appgroup /app
# Switch to non-root user
USER appuser
# HuggingFace Spaces requires port 7860
EXPOSE 7860
# Run the application on port 7860
CMD ["java", "-Dquarkus.http.host=0.0.0.0", "-Dquarkus.http.port=7860", "-jar", "app.jar"]