diff --git a/.gitignore b/.gitignore index ebd4704..89b9c84 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,4 @@ rsyncd.passwd node_modules/ token.txt +run/ diff --git a/Dockerfile b/Dockerfile index 85c875d..35ff25f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,8 @@ RUN buildDeps='software-properties-common git libtool cmake python-dev python3-p 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 && python3 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 + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + mkdir -p /code && useradd -r compiler HEALTHCHECK --interval=5s --retries=3 CMD python3 /code/service.py ADD server /code diff --git a/docker-compose.example.yml b/docker-compose.example.yml index 3c7c2f4..f051139 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -12,8 +12,6 @@ services: - FSETID tmpfs: - /tmp - - /judger_run:exec,mode=777 - - /spj:exec,mode=777 volumes: - $PWD/tests/test_case:/test_case:ro - $PWD/log:/log diff --git a/server/config.py b/server/config.py index 72313b5..1e8a1ea 100644 --- a/server/config.py +++ b/server/config.py @@ -3,7 +3,7 @@ import pwd import grp -JUDGER_WORKSPACE_BASE = "/judger_run" +JUDGER_WORKSPACE_BASE = "/judger/run" LOG_BASE = "/log" COMPILER_LOG_PATH = os.path.join(LOG_BASE, "compile.log") @@ -17,5 +17,5 @@ COMPILER_USER_UID = pwd.getpwnam("compiler").pw_uid COMPILER_GROUP_GID = grp.getgrnam("compiler").gr_gid TEST_CASE_DIR = "/test_case" -SPJ_SRC_DIR = "/spj" -SPJ_EXE_DIR = "/spj" +SPJ_SRC_DIR = "/judger/spj" +SPJ_EXE_DIR = "/judger/spj" diff --git a/server/entrypoint.sh b/server/entrypoint.sh index 4369a8b..817642d 100755 --- a/server/entrypoint.sh +++ b/server/entrypoint.sh @@ -1,5 +1,7 @@ -#!/usr/bin/env bash -chown compiler:compiler /spj +#!/bin/bash +rm -rf /judger/* +mkdir -p /judger/run /judger/spj +chown compiler:compiler /judger/spj core=$(grep --count ^processor /proc/cpuinfo) n=$(($core*2)) exec gunicorn --workers $n --threads $n --error-logfile /log/gunicorn.log --time 600 --bind 0.0.0.0:8080 server:app