NitinBot002 commited on
Commit
a17c6f2
·
verified ·
1 Parent(s): 67189d4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -30
Dockerfile CHANGED
@@ -1,45 +1,33 @@
1
- # Stage 1: Clone and Build
2
- FROM gradle:7.6.0-jdk17 AS builder
3
-
4
- # Install git
5
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6
 
 
7
  WORKDIR /app
8
 
9
- # Clone the Coral Server repository
10
- RUN git clone https://github.com/Coral-Protocol/coral-server.git .
11
-
12
- # Build the application JAR (skip tests)
13
- RUN ./gradlew bootJar -x test --no-daemon || ./gradlew shadowJar -x test --no-daemon || ./gradlew jar -x test --no-daemon
14
-
15
- # Stage 2: Runtime
16
- FROM eclipse-temurin:17-jre-alpine
17
-
18
- # Install curl for health checks
19
- RUN apk add --no-cache curl
20
 
21
- WORKDIR /app
 
22
 
23
- # Copy the built JAR from builder stage
24
- # Try different possible locations where the JAR might be
25
- COPY --from=builder /app/build/libs/*.jar coral-server.jar
26
 
27
- # Copy resources if needed
28
- COPY --from=builder /app/src/main/resources /app/resources
29
 
30
- # Create non-root user
31
- RUN addgroup -g 1001 -S coral && \
32
- adduser -u 1001 -S coral -G coral && \
33
  chown -R coral:coral /app
34
 
 
35
  USER coral
36
 
37
- # Expose port
38
- EXPOSE 5555
39
-
40
  # Health check
41
  HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
42
  CMD curl -f http://localhost:5555/health || exit 1
43
 
44
- # Run the server
45
- ENTRYPOINT ["java", "-jar", "coral-server.jar", "--sse-server", "5555"]
 
1
+ # Use official Python runtime as base image
2
+ FROM python:3.11-slim
 
 
 
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies if needed
8
+ RUN apt-get update && apt-get install -y \
9
+ curl \
10
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
11
 
12
+ # Upgrade pip
13
+ RUN pip install --upgrade pip
14
 
15
+ # Install coral-server from PyPI
16
+ RUN pip install coral-server
 
17
 
18
+ # Expose port 5555
19
+ EXPOSE 5555
20
 
21
+ # Create a non-root user to run the application
22
+ RUN useradd -m -u 1000 coral && \
 
23
  chown -R coral:coral /app
24
 
25
+ # Switch to non-root user
26
  USER coral
27
 
 
 
 
28
  # Health check
29
  HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
30
  CMD curl -f http://localhost:5555/health || exit 1
31
 
32
+ # Run coral-server on port 5555
33
+ CMD ["python", "-m", "coral_server", "--port", "5555"]