NitinBot002 commited on
Commit
3278800
·
verified ·
1 Parent(s): 04374ab

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -6
Dockerfile CHANGED
@@ -10,6 +10,10 @@ RUN git clone https://github.com/Coral-Protocol/coral-server.git .
10
  # Build the application
11
  RUN gradle build --no-daemon -x test
12
 
 
 
 
 
13
  # Runtime stage
14
  FROM openjdk:21-jdk-slim
15
 
@@ -24,24 +28,31 @@ WORKDIR /app
24
 
25
  # Copy built application from build stage
26
  COPY --from=build /app/build/libs/*.jar app.jar
27
- COPY --from=build /app/src/main/resources /app/resources
 
 
 
 
 
28
 
29
  # Create non-root user (required by HF Spaces)
30
- RUN useradd -m -u 1000 user
 
31
  USER user
32
 
33
  # Set environment variables for HF Spaces
34
  ENV HOME=/home/user \
35
  PATH=/home/user/.local/bin:$PATH \
36
  GRADIO_SERVER_NAME=0.0.0.0 \
37
- GRADIO_SERVER_PORT=7860
 
38
 
39
  # HF Spaces expects port 7860
40
  EXPOSE 7860
41
 
42
- # Health check
43
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
44
- CMD curl -f http://localhost:7860/health || exit 1
45
 
46
- # Start the server on port 7860 (HF Spaces default)
47
  CMD ["java", "-Xmx1g", "-Xms512m", "-jar", "app.jar", "--sse-server", "7860"]
 
10
  # Build the application
11
  RUN gradle build --no-daemon -x test
12
 
13
+ # Create coral-config directory and copy config files
14
+ RUN mkdir -p /coral-config && \
15
+ cp -r src/main/resources/* /coral-config/ || true
16
+
17
  # Runtime stage
18
  FROM openjdk:21-jdk-slim
19
 
 
28
 
29
  # Copy built application from build stage
30
  COPY --from=build /app/build/libs/*.jar app.jar
31
+
32
+ # Copy configuration files to the expected location
33
+ COPY --from=build /coral-config /app/src/main/resources
34
+
35
+ # Create coral-config directory as mentioned in the official docs
36
+ RUN mkdir -p /app/coral-config
37
 
38
  # Create non-root user (required by HF Spaces)
39
+ RUN useradd -m -u 1000 user && \
40
+ chown -R user:user /app
41
  USER user
42
 
43
  # Set environment variables for HF Spaces
44
  ENV HOME=/home/user \
45
  PATH=/home/user/.local/bin:$PATH \
46
  GRADIO_SERVER_NAME=0.0.0.0 \
47
+ GRADIO_SERVER_PORT=7860 \
48
+ CONFIG_PATH=/app/coral-config/
49
 
50
  # HF Spaces expects port 7860
51
  EXPOSE 7860
52
 
53
+ # Health check - adjusted URL based on Coral Server endpoints
54
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
55
+ CMD curl -f http://localhost:7860/ || exit 1
56
 
57
+ # Start the server on port 7860
58
  CMD ["java", "-Xmx1g", "-Xms512m", "-jar", "app.jar", "--sse-server", "7860"]