Skip to content

Commit 1fb2da5

Browse files
committed
feat: add tiervnoj
1 parent ea6e7cb commit 1fb2da5

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/tiervnoj.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and push tiervnoj
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
build-and-push-tiervnoj:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-24.04, ubuntu-24.04-arm]
13+
runs-on: ${{ matrix.os }}
14+
15+
permissions:
16+
contents: read
17+
packages: write
18+
attestations: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for tier1
33+
id: meta-tier1
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: |
37+
hnoj/runtimes-tier1
38+
ghcr.io/hnojedu/runtimes-tier1
39+
40+
- name: Build runtimes-tier1
41+
id: build-tier1
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: ./tier1
45+
load: true # make the image available for the next step
46+
tags: ${{ steps.meta-tier1.outputs.tags }}
47+
labels: ${{ steps.meta-tier1.outputs.labels }}
48+
49+
- name: Extract metadata (tags, labels) for tiervnoj
50+
id: meta-tiervnoj
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: |
54+
hnoj/runtimes-tiervnoj
55+
ghcr.io/hnojedu/runtimes-tiervnoj
56+
57+
- name: Build and push runtimes-tiervnoj
58+
id: build-push-tiervnoj
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: ./tiervnoj
62+
push: true
63+
tags: ${{ steps.meta-tiervnoj.outputs.tags }}
64+
labels: ${{ steps.meta-tiervnoj.outputs.labels }}

tiervnoj/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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

Comments
 (0)