Spaces:
Build error
Build error
FROM openjdk:21-jdk-slim | |
WORKDIR /app | |
# Install required packages | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
wget \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy application files | |
COPY . . | |
# Make gradlew executable and build application (if build.gradle.kts or build.gradle exists) | |
RUN if [ -f "build.gradle.kts" ] || [ -f "build.gradle" ]; then \ | |
chmod +x ./gradlew && \ | |
./gradlew build -x test; \ | |
fi | |
# Expose port | |
EXPOSE 8080 | |
# Health check | |
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
CMD curl -f http://localhost:8080/actuator/health || exit 1 | |
# Run application | |
CMD ["java", "-jar", "build/libs/da-policyengine.jar"] | |