|
|
|
|
|
|
|
|
|
|
|
FROM ubuntu:22.04 |
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
|
ca-certificates \ |
|
|
curl \ |
|
|
jq \ |
|
|
git \ |
|
|
unzip \ |
|
|
zip \ |
|
|
build-essential \ |
|
|
pkg-config \ |
|
|
python3 \ |
|
|
python3-pip \ |
|
|
pypy3 \ |
|
|
openjdk-17-jdk \ |
|
|
kotlin \ |
|
|
rustc \ |
|
|
cargo \ |
|
|
golang \ |
|
|
|
|
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ |
|
|
&& apt-get install -y --no-install-recommends nodejs \ |
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN npm install -g npm@latest |
|
|
|
|
|
|
|
|
RUN set -eux; \ |
|
|
arch="$(uname -m)"; \ |
|
|
case "$arch" in \ |
|
|
x86_64) goarch="amd64" ;; \ |
|
|
aarch64) goarch="arm64" ;; \ |
|
|
*) echo "Unsupported arch: $arch" && exit 1 ;; \ |
|
|
esac; \ |
|
|
url=$(curl -fsSL https://api.github.com/repos/criyle/go-judge/releases/latest \ |
|
|
| jq -r --arg goarch "$goarch" '.assets[] | select(.name | test("linux.*\($goarch).*tar.gz$")) | .browser_download_url' \ |
|
|
| head -n 1); \ |
|
|
echo "Downloading go-judge for $arch ($url)"; \ |
|
|
curl -fsSL "$url" | tar -xz -C /usr/local/bin go-judge; \ |
|
|
chmod +x /usr/local/bin/go-judge |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY package.json package-lock.json* ./ |
|
|
RUN npm install --omit=dev --ignore-scripts |
|
|
|
|
|
|
|
|
COPY server.js entrypoint.sh ./ |
|
|
COPY judge/src/ ./src/ |
|
|
COPY judge/include/ ./include/ |
|
|
COPY judge/config/ ./config/ |
|
|
COPY judge/include/ /lib/testlib/ |
|
|
|
|
|
|
|
|
RUN chmod +x entrypoint.sh && sed -i 's/\r$//' entrypoint.sh |
|
|
|
|
|
|
|
|
ENV PORT=8081 \ |
|
|
GJ_ADDR=http://127.0.0.1:5050 \ |
|
|
JUDGE_WORKERS=$(nproc) \ |
|
|
GJ_PARALLELISM=$(nproc) |
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"] |