-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile.rootfs
129 lines (117 loc) · 4.68 KB
/
Dockerfile.rootfs
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
FROM ubuntu:focal AS setup
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
ca-certificates \
wget && \
apt-get autoremove -y && \
apt-get clean
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb \
-O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
aspnetcore-runtime-6.0=6.0.1-1 \
aspnetcore-targeting-pack-6.0=6.0.0-1 \
clang-10 \
dotnet-host=6.0.1-1 \
dotnet-hostfxr-6.0=6.0.1-1 \
dotnet-runtime-6.0=6.0.1-1 \
dotnet-runtime-deps-6.0=6.0.1-1 \
dotnet-sdk-6.0=6.0.101-1 \
dotnet-targeting-pack-6.0=6.0.1-1 \
fp-compiler-3.0.4 \
fp-units-fcl-3.0.4 \
g++-10 \
gcc-10 \
ghc \
git \
libc6-dev \
libcap-dev \
libcap2 \
libz-dev \
locales \
lua5.3 \
make \
openjdk-16-jdk \
openjdk-16-jdk-headless \
openjdk-16-jre \
openjdk-16-jre-headless \
python2.7 \
python3-apt \
python3-pip \
python3.9 \
ruby2.7 \
unzip \
xz-utils \
zlib1g-dev \
&& \
apt-get autoremove -y && \
apt-get clean
RUN ls -l /usr/bin/ | grep -- '[^9] ->.*-9$' | sed -e 's@^.* \(.\+\) -> \(.\+\)-9$@ln -sf \2-10 /usr/bin/\1@' | bash && \
mkdir -p /opt/nodejs && \
wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz \
-O - | tar -xJ -C /opt/nodejs --strip-components=1 && \
mkdir -p /opt/go && \
wget https://go.dev/dl/go1.18beta2.linux-amd64.tar.gz \
-O - | tar -xz -C /opt/go --strip-components=1 && \
mkdir -p /tmp/kotlin && \
wget https://github.com/JetBrains/kotlin/releases/download/v1.6.10/kotlin-compiler-1.6.10.zip \
-O /tmp/kotlin/compiler.zip && \
unzip -d /usr/lib/jvm /tmp/kotlin/compiler.zip && \
rm -rf /tmp/kotlin && \
wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init \
-O /tmp/rustup-init && \
chmod +x /tmp/rustup-init && \
RUSTUP_HOME=/opt/rust/rustup CARGO_HOME=/opt/rust/cargo /tmp/rustup-init --no-modify-path --default-host=x86_64-unknown-linux-gnu --default-toolchain=stable --profile=default -y --quiet && \
rm /tmp/rustup-init && \
wget https://github.com/omegaup/karel.js/releases/download/v0.2.1/karel \
-O /opt/nodejs/karel.wasm && \
wget https://github.com/omegaup/karel.js/releases/download/v0.2.1/karel.js \
-O /opt/nodejs/karel.js && \
chmod +x /opt/nodejs/karel.wasm /opt/nodejs/karel.js && \
wget https://raw.githubusercontent.com/omegaup/libkarel/v0.0.99/libkarel.py \
-O /usr/lib/python2.7/libkarel.py && \
python3.9 -m pip install --target=/usr/lib/python3/dist-packages \
libkarel==1.0.2 omegaup==1.5.4 parsy==1.4.0
RUN mkdir /src
WORKDIR /src
FROM setup AS rootfs-setup
COPY ./tools/mkroot ./tools/java.base.aotcfg ./tools/Main.runtimeconfig.json ./tools/Release.rsp /src/
FROM rootfs-setup AS rootfs-build
RUN /src/mkroot
FROM setup AS runtime
RUN wget --quiet https://github.com/omegaup/libinteractive/releases/download/v2.0.29/libinteractive.jar \
-O /usr/share/java/libinteractive.jar
RUN ln -s /opt/nodejs/bin/node /usr/bin/node && \
ln -s /opt/nodejs/lib/node_modules /usr/lib/node_modules && \
ln -s /opt/rust/rustup /etc/rustup && \
mkdir -p /var/lib/omegajail/root/dev/ && \
cp /dev/null /var/lib/omegajail/root/dev/null
COPY --from=rootfs-build \
/var/lib/omegajail/root-java/java-16-openjdk-amd64/lib/server/classes.jsa \
/usr/lib/jvm/java-16-openjdk-amd64/lib/server/classes.jsa
COPY --from=rootfs-build \
/var/lib/omegajail/root-java/java.base.so \
/usr/lib/jvm/java.base.so
COPY --from=rootfs-build \
/var/lib/omegajail/root-java/kotlin-stdlib.jar.so \
/usr/lib/jvm/kotlin-stdlib.jar.so
COPY --from=rootfs-build \
/var/lib/omegajail/root-dotnet/Main.runtimeconfig.json \
/var/lib/omegajail/root-dotnet/Release.rsp \
/usr/share/dotnet/
COPY --from=rootfs-build \
/var/lib/omegajail/root-compilers/rust-toolchain.toml \
/rust-toolchain.toml
COPY --from=omegaup/omegajail-builder-distrib /var/lib/omegajail/ /var/lib/omegajail
RUN mv /var/lib/omegajail/bin/omegajail /var/lib/omegajail/bin/omegajail.wrapped
COPY ./tools/omegajail-container-wrapper /var/lib/omegajail/bin/omegajail
FROM runtime AS runtime-debug
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
strace \
&& \
apt-get autoremove -y && \
apt-get clean