Spaces:
Build error
Build error
| # Base image with JDK 21 | |
| FROM openjdk:21-jdk-slim | |
| # Install all required packages including unzip | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| git \ | |
| curl \ | |
| wget \ | |
| unzip \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set Python3 as default | |
| RUN ln -s /usr/bin/python3 /usr/bin/python | |
| # Install Gradle | |
| ENV GRADLE_VERSION=8.5 | |
| RUN wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \ | |
| unzip -q gradle-${GRADLE_VERSION}-bin.zip && \ | |
| mv gradle-${GRADLE_VERSION} /opt/gradle && \ | |
| rm gradle-${GRADLE_VERSION}-bin.zip | |
| # Add Gradle to PATH | |
| ENV PATH=$PATH:/opt/gradle/bin | |
| WORKDIR /app | |
| # Clone coral-server repository | |
| RUN git clone https://github.com/Coral-Protocol/coral-server.git /app/coral-server | |
| # Try to build coral-server (allow failure) | |
| WORKDIR /app/coral-server | |
| RUN gradle build -x test || echo "Build failed, will retry at runtime" | |
| # Check for JAR file | |
| RUN if [ -f build/libs/*.jar ]; then \ | |
| cp build/libs/*.jar /app/coral-server.jar; \ | |
| else \ | |
| echo "JAR not found, will use gradle run"; \ | |
| fi | |
| WORKDIR /app | |
| # Install Python dependencies | |
| RUN pip3 install --no-cache-dir \ | |
| requests \ | |
| psutil | |
| # Copy Python wrapper | |
| COPY coral_wrapper.py /app/ | |
| # Create config directory | |
| RUN mkdir -p /config | |
| # Expose port | |
| EXPOSE 5555 | |
| # Environment variables | |
| ENV JAVA_HOME=/usr/local/openjdk-21 | |
| ENV CORAL_PORT=5555 | |
| # Run Python wrapper | |
| CMD ["python", "coral_wrapper.py"] |