File size: 868 Bytes
f568829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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"]