|
| 1 | +FROM hnoj/runtimes-tier1 |
| 2 | + |
| 3 | +RUN apt-get update && \ |
| 4 | + apt-get install -y --no-install-recommends openjdk-22-jdk-headless openjdk-22-jre-headless golang unzip jq && \ |
| 5 | + rm -rf /var/lib/apt/lists/* |
| 6 | + |
| 7 | +# Install scratch-run + pypy + kotlin + rust |
| 8 | +RUN ARCH=$([ $(uname -m) = "x86_64" ] && echo "amd64" || echo "arm64") && \ |
| 9 | + curl --location -o scratch-run.zip $(curl -s https://api.github.com/repos/VNOI-Admin/scratch-run/releases/latest | grep -o -m 1 "https://github\.com.*.*linux_$ARCH\.zip") && \ |
| 10 | + unzip scratch-run.zip && \ |
| 11 | + mv scratch-run /usr/bin/scratch-run && \ |
| 12 | + rm scratch-run.zip && \ |
| 13 | + if [ "$(arch)" = x86_64 ]; then PYPY_ARCH=linux64; else PYPY_ARCH="$(arch)"; fi && \ |
| 14 | + mkdir /opt/pypy2 && curl -L "$(curl https://pypy.org/download.html | grep "/pypy2.*$PYPY_ARCH" | head -n1 | cut -d'"' -f4)" | \ |
| 15 | + tar xj -C /opt/pypy2 --strip-components=1 && /opt/pypy2/bin/pypy -mcompileall && \ |
| 16 | + chmod a+rx /opt/pypy2/lib /opt/pypy2/lib/*.so* && \ |
| 17 | + rm -f /opt/pypy2/bin/python* && \ |
| 18 | + mkdir /opt/pypy3 && curl -L "$(curl https://pypy.org/download.html | grep "/pypy3.*$PYPY_ARCH" | head -n1 | cut -d'"' -f4)" | \ |
| 19 | + tar xj -C /opt/pypy3 --strip-components=1 && /opt/pypy3/bin/pypy -mcompileall && \ |
| 20 | + rm -f /opt/pypy3/bin/python* && \ |
| 21 | + curl -L -okotlin.zip "$(curl -s https://api.github.com/repos/JetBrains/kotlin/releases | \ |
| 22 | + jq -r '[.[] | select(.prerelease | not) | .assets | flatten | .[] | select((.name | startswith("kotlin-compiler")) and (.name | endswith(".zip"))) | .browser_download_url][0]')" && \ |
| 23 | + unzip kotlin.zip && mv kotlinc /opt/kotlin && rm kotlin.zip && \ |
| 24 | + runuser judge -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y' && \ |
| 25 | + mkdir rust && ( \ |
| 26 | + cd rust && \ |
| 27 | + curl -sL https://raw.githubusercontent.com/DMOJ/judge/master/dmoj/executors/RUST.py | \ |
| 28 | + sed '/^CARGO_TOML/,/^"""/!d;//d' > Cargo.toml && \ |
| 29 | + mkdir src && \ |
| 30 | + curl -sL https://raw.githubusercontent.com/DMOJ/judge/master/dmoj/executors/RUST.py | \ |
| 31 | + sed '/^TEST_PROGRAM/,/^"""/!d;//d' > src/main.rs && \ |
| 32 | + chown -R judge: . && \ |
| 33 | + runuser -u judge /home/judge/.cargo/bin/cargo fetch \ |
| 34 | + ) && \ |
| 35 | + rm -rf rust |
| 36 | + |
| 37 | +ENV PATH="/opt/kotlin/bin:/opt/pypy2/bin:/opt/pypy3/bin:/home/judge/.cargo/bin:${PATH}" |
0 commit comments