mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2024-12-28 21:31:43 +00:00
优化dockerfile, 修复striped_output_md5找不到的问题
This commit is contained in:
parent
41ec65e15d
commit
e41baa8ef3
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,6 +36,7 @@ coverage.xml
|
||||
# Rope
|
||||
.ropeproject
|
||||
.idea/
|
||||
.vscode/
|
||||
# Django stuff:
|
||||
*.log
|
||||
*.pot
|
||||
|
@ -1,16 +1,23 @@
|
||||
FROM ubuntu:16.04
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install software-properties-common python-software-properties python python-dev gcc g++ git libtool python-pip libseccomp-dev cmake
|
||||
RUN add-apt-repository ppa:openjdk-r/ppa
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y openjdk-7-jdk
|
||||
RUN cd /tmp && git clone https://github.com/QingdaoU/Judger && cd Judger && git checkout newnew && mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python setup.py install
|
||||
RUN mkdir -p /judger_run /test_case /log /code
|
||||
|
||||
COPY java_policy /etc
|
||||
RUN pip install futures psutil gunicorn web.py requests
|
||||
RUN useradd -r compiler
|
||||
|
||||
RUN buildDeps='software-properties-common git libtool cmake python-dev python-pip libseccomp-dev' && \
|
||||
apt-get update && apt-get install -y python python-pkg-resources gcc g++ $buildDeps && \
|
||||
add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-7-jdk && \
|
||||
pip install --no-cache-dir futures psutil gunicorn web.py requests && \
|
||||
cd /tmp && git clone -b newnew --depth 1 https://github.com/QingdaoU/Judger && cd Judger && \
|
||||
mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python setup.py install && \
|
||||
apt-get purge -y --auto-remove $buildDeps && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /judger_run /test_case /log /code && \
|
||||
useradd -r compiler
|
||||
|
||||
HEALTHCHECK --interval=5s --retries=3 CMD python /code/service.py
|
||||
WORKDIR /code
|
||||
|
||||
VOLUME ["/code"]
|
||||
EXPOSE 8080
|
||||
CMD /bin/bash /code/run.sh
|
||||
CMD /bin/bash /code/run.sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
version: "2"
|
||||
services:
|
||||
judge_server:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/v-image/judge_server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/judge_server
|
||||
read_only: true
|
||||
cap_drop:
|
||||
- SETPCAP
|
||||
@ -15,12 +15,12 @@ services:
|
||||
- /judger_run:exec,mode=777
|
||||
- /spj:exec,mode=777
|
||||
volumes:
|
||||
- $PWD/tests/test_case:/test_case
|
||||
- $PWD/tests/test_case:/test_case:ro
|
||||
- /data/log:/log
|
||||
- $PWD/server:/code:ro
|
||||
environment:
|
||||
- service_discovery_url=https://virusdefender.net/service.php
|
||||
- service_url=http://1.2.3.4:12358
|
||||
- token=YOUR_TOKEN_HERE
|
||||
- service_discovery_url=http://127.0.0.1:8000/api/judge_server_heartbeat
|
||||
- service_url=http://127.0.0.1:12358
|
||||
- TOKEN=YOUR_TOKEN_HERE
|
||||
ports:
|
||||
- "0.0.0.0:12358:8080"
|
||||
|
@ -61,7 +61,7 @@ class JudgeClient(object):
|
||||
with open(user_output_file, "r") as f:
|
||||
content = f.read()
|
||||
output_md5 = hashlib.md5(content.rstrip()).hexdigest()
|
||||
result = output_md5 == self._get_test_case_file_info(test_case_file_id)["striped_output_md5"]
|
||||
result = output_md5 == self._get_test_case_file_info(test_case_file_id)["stripped_output_md5"]
|
||||
return output_md5, result
|
||||
|
||||
def _spj(self, in_file_path, user_out_file_path):
|
||||
|
@ -4,5 +4,4 @@ echo 0 > /tmp/counter
|
||||
core=$(grep --count ^processor /proc/cpuinfo)
|
||||
n=$(($core*2))
|
||||
chmod 400 /tmp/counter
|
||||
chmod -R 400 /test_case
|
||||
gunicorn --workers $n --threads $n --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:8080 server:wsgiapp
|
||||
exec gunicorn --workers $n --threads $n --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:8080 server:wsgiapp
|
||||
|
@ -28,11 +28,11 @@ def server_info():
|
||||
|
||||
|
||||
def get_token():
|
||||
token = os.environ.get("token")
|
||||
token = os.environ.get("TOKEN")
|
||||
if token:
|
||||
return token
|
||||
else:
|
||||
raise JudgeClientError("ENV token not found")
|
||||
raise JudgeClientError("ENV TOKEN not found")
|
||||
|
||||
|
||||
token = hashlib.sha256(get_token()).hexdigest()
|
||||
|
@ -1 +1 @@
|
||||
{"test_case_number": 1, "spj": false, "test_cases": {"1": {"striped_output_md5": "eccbc87e4b5ce2fe28308fd9f2a7baf3", "output_size": 2, "output_md5": "6d7fce9fee471194aa8b5b6e47267f03", "input_name": "1.in", "input_size": 4, "output_name": "1.out"}}}
|
||||
{"test_case_number": 1, "spj": false, "test_cases": {"1": {"stripped_output_md5": "eccbc87e4b5ce2fe28308fd9f2a7baf3", "output_size": 2, "output_md5": "6d7fce9fee471194aa8b5b6e47267f03", "input_name": "1.in", "input_size": 4, "output_name": "1.out"}}}
|
||||
|
Loading…
Reference in New Issue
Block a user