Download harness/Dockerfile from ComerX/forgebench-v2: direct link, hf CLI and curl.
- Browser
- Download file 4.77 kB
-
https://huggingface.co/datasets/ComerX/forgebench-v2/resolve/main/harness/Dockerfile
- Command line
-
hf download hf://datasets/ComerX/forgebench-v2/harness/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/datasets/ComerX/forgebench-v2/resolve/main/harness/Dockerfile
4.77 kB
| # ForgeBench v2 sandbox image - DUAL TARGET | |
| # Two pre-configured MDK templates, side by side: | |
| # /opt/forgebench/template-neoforge-1.21.1 (NeoForge 21.1.77, NeoGradle 7, JDK 21, Gradle 8.9) | |
| # /opt/forgebench/template-forge-1.20.1 (Forge 47.3.0, ForgeGradle 6, JDK 17, Gradle 8.1.1) | |
| # sandbox_runner.py injects the LLM answer (single file OR a candidate directory) into the | |
| # template selected by --target and runs the real Gradle build headlessly. | |
| # No Minecraft server is launched. Raw `javac` is never used. No Mockito. | |
| # | |
| # Build: docker build -t forgebench-sandbox:v2 . | |
| # Run (NeoForge target): | |
| # docker run --rm -v $(pwd)/out:/out forgebench-sandbox:v2 \ | |
| # python3 /opt/forgebench/harness/sandbox_runner.py \ | |
| # --task-file /out/task.json --code-file /out/answer.java --target neoforge-1.21.1 | |
| # Run (Forge target): | |
| # docker run --rm -v $(pwd)/out:/out forgebench-sandbox:v2 \ | |
| # python3 /opt/forgebench/harness/sandbox_runner.py \ | |
| # --task-file /out/task.json --code-file /out/answer.java --target forge-1.20.1 | |
| # Run (multi-file porting; candidate dir mirrors the repository layout): | |
| # docker run --rm -v $(pwd)/out:/out forgebench-sandbox:v2 \ | |
| # python3 /opt/forgebench/harness/sandbox_runner.py \ | |
| # --task-file /out/task.json --candidate-dir /out/candidate --target neoforge-1.21.1 | |
| FROM eclipse-temurin:21-jdk-jammy | |
| ARG GRADLE_VERSION=8.9 | |
| ARG GRADLE_FORGE_VERSION=8.1.1 | |
| ARG NEOFORGE_VERSION=21.1.77 | |
| ARG FORGE_VERSION=1.20.1-47.3.0 | |
| ENV DEBIAN=noninteractive | |
| ENV GRADLE_USER_HOME=/opt/gradle-home | |
| ENV NEOFORGE_VERSION=${NEOFORGE_VERSION} | |
| ENV FORGE_VERSION=${FORGE_VERSION} | |
| # --- system deps ------------------------------------------------------------- | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git curl unzip ca-certificates python3 python3-pip jq wget gnupg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # --- JDK 17 (Forge 1.20.1 target) alongside the base JDK 21 (NeoForge target) -- | |
| RUN curl -fsSL "https://packages.adoptium.net/artifactory/api/gpg/key/public" \ | |
| | gpg --dearmor -o /etc/apt/trusted.gpg.d/adoptium.gpg \ | |
| && echo "deb https://packages.adoptium.net/artifactory/deb jammy main" \ | |
| > /etc/apt/sources.list.d/adoptium.list \ | |
| && apt-get update && apt-get install -y --no-install-recommends temurin-17-jdk-jammy \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV JAVA_HOME_21=/usr/lib/jvm/temurin-21-jdk-amd64 | |
| ENV JAVA_HOME_17=/usr/lib/jvm/temurin-17-jdk-amd64 | |
| # --- Gradle 8.9 (NeoForge/NeoGradle) and Gradle 8.1.1 (ForgeGradle 6) --------- | |
| RUN curl -fsSLo /tmp/gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \ | |
| && unzip -q /tmp/gradle.zip -d /opt/ \ | |
| && ln -s /opt/gradle-${GRADLE_VERSION}/bin/gradle /usr/local/bin/gradle \ | |
| && rm /tmp/gradle.zip \ | |
| && curl -fsSLo /tmp/gradle-f.zip https://services.gradle.org/distributions/gradle-${GRADLE_FORGE_VERSION}-bin.zip \ | |
| && unzip -q /tmp/gradle-f.zip -d /opt/ \ | |
| && ln -s /opt/gradle-${GRADLE_FORGE_VERSION}/bin/gradle /usr/local/bin/gradle-8.1.1 \ | |
| && rm /tmp/gradle-f.zip | |
| # --- python harness deps ----------------------------------------------------- | |
| COPY harness/requirements.txt /opt/forgebench/requirements.txt | |
| RUN pip3 install --no-cache-dir -r /opt/forgebench/requirements.txt | |
| # --- both MDK templates ------------------------------------------------------ | |
| # template-neoforge-1.21.1/: minimal but COMPLETE NeoForge 1.21.1 mod project | |
| # (NeoGradle 7 userdev, neoforge.mods.toml, mixins config). | |
| # template-forge-1.20.1/: minimal but COMPLETE Forge 1.20.1 mod project | |
| # (ForgeGradle 6, mods.toml, official mappings, Java 17 toolchain). | |
| COPY template-neoforge-1.21.1/ /opt/forgebench/template-neoforge-1.21.1/ | |
| COPY template-forge-1.20.1/ /opt/forgebench/template-forge-1.20.1/ | |
| # Pre-warm both dependency caches so each evaluation does not re-download the world. | |
| # (First build populates /opt/gradle-home; subsequent runs are offline-capable.) | |
| RUN cd /opt/forgebench/template-neoforge-1.21.1 && gradle --no-daemon help || true | |
| RUN cd /opt/forgebench/template-forge-1.20.1 && /usr/local/bin/gradle-8.1.1 --no-daemon help || true | |
| COPY harness/ /opt/forgebench/harness/ | |
| # Non-root runner; keep the build filesystem writable | |
| RUN useradd -ms /bin/bash evaluator | |
| USER evaluator | |
| WORKDIR /home/evaluator | |
| # Hardened defaults: fixed locale | |
| ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | |
| # Target selection defaults (overridable per call): | |
| ENV FORGEBENCH_TEMPLATE_NEOFORGE_1211=/opt/forgebench/template-neoforge-1.21.1 | |
| ENV FORGEBENCH_TEMPLATE_FORGE_1201=/opt/forgebench/template-forge-1.20.1 | |
| ENV FORGEBENCH_GRADLE_NEOFORGE_1211=gradle | |
| ENV FORGEBENCH_GRADLE_FORGE_1201=/usr/local/bin/gradle-8.1.1 | |
| ENTRYPOINT ["python3", "/opt/forgebench/harness/sandbox_runner.py"] | |