Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +18 -30
Dockerfile
CHANGED
|
@@ -1,45 +1,33 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 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 |
-
#
|
| 10 |
-
RUN
|
| 11 |
-
|
| 12 |
-
|
| 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 |
-
|
|
|
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
COPY --from=builder /app/build/libs/*.jar coral-server.jar
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
|
| 30 |
-
# Create non-root user
|
| 31 |
-
RUN
|
| 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
|
| 45 |
-
|
|
|
|
| 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"]
|