Skip to content

Commit b9268a8

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

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

.github/workflows/tiervnoj.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
ghcr.io/hnojedu/runtimes-tier1
38+
39+
- name: Build runtimes-tier1
40+
id: build-tier1
41+
uses: docker/build-push-action@v6
42+
with:
43+
context: ./tier1
44+
tags: ${{ steps.meta-tier1.outputs.tags }}
45+
labels: ${{ steps.meta-tier1.outputs.labels }}
46+
47+
- name: Extract metadata (tags, labels) for tiervnoj
48+
id: meta-tiervnoj
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: |
52+
ghcr.io/hnojedu/runtimes-tiervnoj
53+
54+
- name: Build and push runtimes-tiervnoj
55+
id: build-push-tiervnoj
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: ./tiervnoj
59+
push: true
60+
tags: ${{ steps.meta-tiervnoj.outputs.tags }}
61+
labels: ${{ steps.meta-tiervnoj.outputs.labels }}

tiervnoj/Dockerfile

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

0 commit comments

Comments
 (0)