diff --git a/dockerfiles/judger/Dockerfile b/dockerfiles/judger/Dockerfile index f13a9a5d..5bc0bd89 100644 --- a/dockerfiles/judger/Dockerfile +++ b/dockerfiles/judger/Dockerfile @@ -1,5 +1,4 @@ FROM ubuntu:14.04 -MAINTAINER virusdefender RUN mkdir /var/install/ WORKDIR /var/install/ ENV DEBIAN_FRONTEND noninteractive diff --git a/dockerfiles/oj_web_server/Dockerfile b/dockerfiles/oj_web_server/Dockerfile index 93623f75..be362431 100644 --- a/dockerfiles/oj_web_server/Dockerfile +++ b/dockerfiles/oj_web_server/Dockerfile @@ -1,8 +1,15 @@ FROM python:2.7 ENV PYTHONBUFFERED 1 RUN mkdir -p /code/log /code/test_case /code/upload +RUN chown -R nobody:nogroup /code/log /code/test_case /code/upload WORKDIR /code ADD requirements.txt /code/ RUN pip install -i http://pypi.douban.com/simple -r requirements.txt --trusted-host pypi.douban.com -EXPOSE 8010 -CMD supervisord +RUN rm /etc/apt/sources.list +ADD sources.list /etc/apt/ +RUN curl -sL https://deb.nodesource.com/setup | bash - +RUN apt-get -y install nodejs +ADD gunicorn.conf /etc +ADD supervisord.conf /etc +ADD task_queue.conf /etc +CMD bash /code/dockerfiles/oj_web_server/run.sh \ No newline at end of file diff --git a/dockerfiles/oj_web_server/gunicorn.conf b/dockerfiles/oj_web_server/gunicorn.conf index 3ad64967..d1129d14 100644 --- a/dockerfiles/oj_web_server/gunicorn.conf +++ b/dockerfiles/oj_web_server/gunicorn.conf @@ -1,16 +1,12 @@ [program:gunicorn] - command=gunicorn oj.wsgi:application -b 0.0.0.0:8080 --reload - directory=/code/ -user=root +user=nobody numprocs=1 stdout_logfile=/code/log/gunicorn.log stderr_logfile=/code/log/gunicorn.log autostart=true autorestart=true startsecs=5 - stopwaitsecs = 6 - killasgroup=true \ No newline at end of file diff --git a/dockerfiles/oj_web_server/run.sh b/dockerfiles/oj_web_server/run.sh new file mode 100644 index 00000000..225df031 --- /dev/null +++ b/dockerfiles/oj_web_server/run.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +find /code -name "*.pyc" -delete +python -m compileall /code +exec supervisord \ No newline at end of file diff --git a/dockerfiles/oj_web_server/supervisord.conf b/dockerfiles/oj_web_server/supervisord.conf index dec4bf49..a39b20fe 100644 --- a/dockerfiles/oj_web_server/supervisord.conf +++ b/dockerfiles/oj_web_server/supervisord.conf @@ -1,26 +1,21 @@ [unix_http_server] -file=/tmp/supervisor.sock ; path to your socket file - +file=/tmp/supervisor.sock [supervisord] -logfile=/code/log/supervisord.log ; supervisord log file -logfile_maxbytes=50MB ; maximum size of logfile before rotation -logfile_backups=10 ; number of backed up logfiles -loglevel=info ; info, debug, warn, trace -pidfile=/code/log/supervisord.pid ; pidfile location -nodaemon=true ; run supervisord as a daemon -minfds=1024 ; number of startup file descriptors -minprocs=200 ; number of process descriptors -user=root ; default user -childlogdir=/code/log/ ; where child log files will live - +logfile=/code/log/supervisord.log +logfile_maxbytes=50MB +logfile_backups=10 +loglevel=info +pidfile=/code/log/supervisord.pid +nodaemon=true +minfds=1024 +minprocs=200 +user=nobody +childlogdir=/code/log/ [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface - [supervisorctl] -serverurl=unix:///tmp/supervisor.sock ; use unix:// schem for a unix sockets. - +serverurl=unix:///tmp/supervisor.sock [include] - files=gunicorn.conf task_queue.conf \ No newline at end of file diff --git a/dockerfiles/oj_web_server/task_queue.conf b/dockerfiles/oj_web_server/task_queue.conf index 5a9b13f7..5fb64b35 100644 --- a/dockerfiles/oj_web_server/task_queue.conf +++ b/dockerfiles/oj_web_server/task_queue.conf @@ -1,16 +1,12 @@ [program:task_queue] - command=python manage.py celeryd -B -l DEBUG - directory=/code/ -user=root +user=nobody numprocs=1 stdout_logfile=/code/log/task_queue.log stderr_logfile=/code/log/task_queue.log autostart=true autorestart=true startsecs=5 - stopwaitsecs = 6 - killasgroup=true \ No newline at end of file