-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
68 lines (56 loc) · 2.14 KB
/
Dockerfile
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
FROM ubuntu:18.04
MAINTAINER SDUOJ-Team
ENV LANG C.UTF-8
COPY docker/sources.list /etc/apt/sources.list
COPY docker/testlib /testlib.h
# download docker-compose-wait
COPY --from=sduoj/docker-compose-wait:latest /wait /wait
RUN mkdir -p /sduoj/dockerWorkspace
# install JDKs
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:8 $JAVA_HOME ${JAVA_HOME}8
#COPY --from=eclipse-temurin:17 $JAVA_HOME ${JAVA_HOME}17
# set the default JDK to JDK8
ENV JAVA_HOME=/opt/java/openjdk8
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# install OS softwares
RUN apt-get update \
&& apt-get install -qq -y \
make=4.1-9.1ubuntu1 dosbox=0.74-4.3 cmake \
sudo git unzip wget libseccomp-dev libseccomp2 seccomp build-essential \
python3-pip python vim dos2unix
# compile and install sduoj-sandbox
RUN wget -q -O /sduoj/sandbox.zip https://codeload.github.com/SDUOJ/sduoj-sandbox/zip/master \
&& unzip -o -q -d /sduoj /sduoj/sandbox.zip \
&& rm /sduoj/sandbox.zip \
&& cd /sduoj/sduoj-sandbox* \
&& make \
&& make install
# download source code
RUN wget -q -O /sduoj/server.zip https://codeload.github.com/SDUOJ/sduoj-server/zip/stable \
&& wget -q -O /sduoj/judger.zip https://codeload.github.com/SDUOJ/sduoj-judger/zip/stable \
&& unzip -o -q -d /sduoj/dockerWorkspace /sduoj/server.zip \
&& unzip -o -q -d /sduoj/dockerWorkspace /sduoj/judger.zip \
&& rm /sduoj/server.zip \
&& rm /sduoj/judger.zip
# compile and install sduoj-server
RUN cd /sduoj/dockerWorkspace/sduoj-server* \
&& chmod +x ./gradlew \
&& ./gradlew publishToMavenLocal -x test \
# compile sduoj-judger
&& cd /sduoj/dockerWorkspace/sduoj-judger* \
&& chmod +x ./gradlew \
&& ./gradlew build \
&& mv ./sduoj-judger-service/build/libs/sduoj-judger.jar /sduoj/sduoj-judger.jar \
# clean
&& rm -rf ~/.m2 \
&& rm -rf ~/.gradle \
&& rm -rf /sduoj/dockerWorkspace
ENV NACOS_ADDR=127.0.0.1:8848
ENV ACTIVE=prod
WORKDIR /sduoj
CMD /wait \
&& java -jar sduoj-judger.jar \
--sduoj.config.nacos-addr=$NACOS_ADDR \
--sduoj.config.active=$ACTIVE \
>> /sduoj/sduoj.log