# STEP 1: Build stage FROM gradle:8-jdk17 AS build WORKDIR /home/gradle/src COPY --chown=gradle:gradle . . RUN gradle jar --no-daemon # STEP 2: Runtime stage FROM eclipse-temurin:17-jre WORKDIR /app # Copy files COPY --from=build /home/gradle/src/build/libs/*.jar app.jar COPY *.json . # Hugging Face uses user 1000 USER root RUN chmod -R 777 /app # THE FIX: We use a shell to inject the Discord IP into the hosts file # right before starting Java. This bypasses the DNS system entirely. ENTRYPOINT ["/bin/sh", "-c", "echo '162.159.138.232 discord.com' >> /etc/hosts && java -Dsun.net.inetaddr.ttl=0 -Dsun.net.inetaddr.negative.ttl=0 -jar app.jar"]