-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdodona-tested.dockerfile
More file actions
160 lines (137 loc) · 5.38 KB
/
Copy pathdodona-tested.dockerfile
File metadata and controls
160 lines (137 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# This file is autogenerated by the dodona-edu/universal-judge repository
# Any changes will be overwritten by the CI
# This is the Dockerfile for the tested judge.
# It can be downloaded using docker pull dodona/dodona-tested.
# This docker image is run in our production environment.
# It should not contain any development tools or dependencies.
# Add those to dev-dependencies.sh instead.
FROM python:3.12.4-slim-bullseye
# Set up the environment
# Kotlin
ENV SDKMAN_DIR=/usr/local/sdkman
ENV PATH=$SDKMAN_DIR/candidates/kotlin/current/bin:$PATH
ENV PATH=$SDKMAN_DIR/candidates/java/current/bin:$PATH
# Haskell
ENV HASKELL_DIR=/usr/local/ghcupdir
ENV PATH=$HASKELL_DIR/ghc/bin:$PATH
ENV PATH=$HASKELL_DIR/cabal:$PATH
# Node
ENV NODE_PATH=/usr/lib/node_modules
# Install dependencies
# hadolint ignore=DL3013,DL3016
RUN <<EOF
# Update apt-get
apt-get update
# Drop docs/man/locale from all apt-installed packages (keep copyright for licensing)
cat > /etc/dpkg/dpkg.cfg.d/01_nodoc <<'CFG'
path-exclude /usr/share/doc/*
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
path-exclude /usr/share/locale/*
CFG
# Install general dependencies
apt-get install -y --no-install-recommends \
procps \
dos2unix \
curl \
zip \
unzip
# Python dependencies
pip install --no-cache-dir --upgrade \
psutil==5.9.8 \
attrs==23.2.0 \
cattrs==23.2.3 \
jsonschema==4.22.0 \
typing_inspect==0.9.0 \
pyyaml==6.0.1 \
Pygments==2.18.0 \
python-i18n==0.3.9 \
pylint==3.0.1
# C/C++ dependencies
apt-get install -y --no-install-recommends \
gcc \
cppcheck
# Bash dependencies
apt-get install -y --no-install-recommends \
bc \
binutils \
bsdmainutils \
cowsay \
ed \
figlet \
file \
toilet \
tree \
vim \
xxd \
shellcheck
# JavaScript dependencies
bash -c 'set -o pipefail && curl -fsSL https://deb.nodesource.com/setup_22.x | bash -'
apt-get install -y --no-install-recommends nodejs
npm install -g eslint@8.57 abstract-syntax-tree@2.22
# TypeScript dependencies
npm install -g typescript@5.6.3 tsx@4.19.2
npm install -g @types/node @typescript-eslint/parser @typescript-eslint/eslint-plugin
# Haskell dependencies
apt-get install -y --no-install-recommends \
hlint \
autoconf \
build-essential \
zlib1g-dev \
libgmp-dev
bash -c "set -o pipefail && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh"
bash -c "source /root/.ghcup/env && ghcup install ghc 9.6 --isolate $HASKELL_DIR/ghc"
bash -c "source /root/.ghcup/env && ghcup install cabal --isolate $HASKELL_DIR/cabal"
cabal update
cabal v1-install --global aeson
# GHC: drop profiling libs/interfaces, haddock/HTML docs, and debug symbols (unused at runtime)
find "$HASKELL_DIR/ghc" -type f \( -name '*_p.a' -o -name '*.p_o' -o -name '*.p_hi' \) -delete
rm -rf "$HASKELL_DIR/ghc/share/doc" "$HASKELL_DIR/ghc"/lib/*/doc
find "$HASKELL_DIR/ghc" -type f -name '*.so*' -exec strip --strip-unneeded {} + 2>/dev/null || true
find "$HASKELL_DIR/ghc/bin" -type f -exec strip --strip-unneeded {} + 2>/dev/null || true
# C# dependencies
curl https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb --output packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update
apt-get install -y --no-install-recommends dotnet-sdk-8.0
# Java and Kotlin dependencies
bash -c 'set -o pipefail && curl -s "https://get.sdkman.io?rcupdate=false" | bash'
chmod a+x "$SDKMAN_DIR/bin/sdkman-init.sh"
bash -c "source \"$SDKMAN_DIR/bin/sdkman-init.sh\" && sdk install java 21.0.3-tem && sdk install kotlin"
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.2.1/ktlint
chmod a+x ktlint
mv ktlint /usr/local/bin
# Java specific dependencies
apt-get install -y --no-install-recommends checkstyle
# Exercise dependencies
pip install --no-cache-dir --upgrade \
numpy==2.4.6 \
pandas==3.0.3 \
openpyxl==3.1.5 \
matplotlib==3.10.9
# Clean up caches
apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf /root/.cache
rm -rf /root/.npm
rm -rf /usr/local/sdkman/tmp
# Haskell: downloaded Hackage tarballs and ghcup download cache (aeson lives in GHC's global db)
rm -rf /root/.cabal/packages /root/.cabal/logs /root/.ghcup/cache /root/.ghcup/tmp
# .NET: NuGet/dotnet download and first-run caches (SDK itself untouched)
rm -rf /root/.nuget /root/.dotnet /tmp/NuGet* /tmp/.dotnet "${HOME}/.local/share/NuGet"
# sdkman: extracted JDK/Kotlin zips, plus JDK sources and man pages (not needed to compile/run)
rm -rf "$SDKMAN_DIR/archives/"* "$SDKMAN_DIR/tmp/"*
rm -f "$SDKMAN_DIR"/candidates/java/*/src.zip
rm -rf "$SDKMAN_DIR"/candidates/java/*/man "$SDKMAN_DIR"/candidates/kotlin/*/licenses
# Setup permissions and user
chmod 711 /mnt
useradd -m runner
mkdir /home/runner/workdir
chown -R runner:runner /home/runner/workdir
EOF
USER runner
WORKDIR /home/runner/workdir
COPY main.sh /main.sh