增加docker部署配置

This commit is contained in:
virusdefender 2016-09-28 19:55:39 +08:00
parent 18a41e089b
commit d8ae42ca07
6 changed files with 63 additions and 6 deletions

View File

@ -1,5 +1,21 @@
FROM judger
RUN apt-get update && apt-get install -y cmake vim
RUN cd /tmp && rm -rf Judger && git clone https://github.com/QingdaoU/Judger.git && cd Judger && git checkout newnew && mkdir build && cd build && cmake .. && make && make install && cd ../bindings/Python && python setup.py install
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN rm /etc/apt/sources.list
COPY deploy/sources.list /etc/apt/
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 -y ppa:webupd8team/java
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
RUN apt-get update
RUN apt-get install -y oracle-java7-installer
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 /var/wp
RUN pip install psutil gunicorn web.py
RUN mkdir -p /judger_run /test_case /log /code
COPY deploy/java_policy /etc
COPY deploy/supervisord.conf /etc
RUN chmod -R 777 /judger_run
RUN pip install supervisor psutil gunicorn web.py
EXPOSE 8080
CMD exec supervisord

View File

@ -5,10 +5,11 @@ import grp
import os
import pwd
JUDGER_WORKSPACE_BASE = "/var/wp"
JUDGER_WORKSPACE_BASE = "/judger_run"
LOG_BASE = "/log"
COMPILER_LOG_PATH = os.path.join(JUDGER_WORKSPACE_BASE, "compile.log")
JUDGER_RUN_LOG_PATH = os.path.join(JUDGER_WORKSPACE_BASE, "judger.log")
COMPILER_LOG_PATH = os.path.join(LOG_BASE, "compile.log")
JUDGER_RUN_LOG_PATH = os.path.join(LOG_BASE, "judger.log")
LOW_PRIVILEDGE_UID = pwd.getpwnam("nobody").pw_uid
LOW_PRIVILEDGE_GID = grp.getgrnam("nogroup").gr_gid

10
deploy/sources.list Normal file
View File

@ -0,0 +1,10 @@
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

20
deploy/supervisord.conf Normal file
View File

@ -0,0 +1,20 @@
[supervisord]
logfile=/log/judger_supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/log/judger_supervisord.pid
nodaemon=true
childlogdir=/log/
[program:judger_server]
command=gunicorn -w 4 -b 0.0.0.0:8080 server:wsgiapp
directory=/code
numprocs=1
stdout_logfile=/log/judger_server.log
stderr_logfile=/log/judger_server.log
autostart=true
autorestart=true
startsecs=5
stopwaitsecs = 5
killasgroup=true

View File

@ -0,0 +1,10 @@
judge_server:
image: judge_server
volumes:
- /data/test_case:/test_case
- /data/log:/log
- /data/JudgeServer:/code
environments:
- judger_token=PLEASE_REPLACE_TO_SECRET_TOKEN
ports:
- "0.0.0.0:11235:8080"