mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
docker 内 server 降权运行
This commit is contained in:
parent
8bf4166d5d
commit
6aaa31386b
@ -1,5 +1,4 @@
|
|||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
MAINTAINER virusdefender<qduliyang@outlook.com>
|
|
||||||
RUN mkdir /var/install/
|
RUN mkdir /var/install/
|
||||||
WORKDIR /var/install/
|
WORKDIR /var/install/
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|||||||
@ -1,8 +1,15 @@
|
|||||||
FROM python:2.7
|
FROM python:2.7
|
||||||
ENV PYTHONBUFFERED 1
|
ENV PYTHONBUFFERED 1
|
||||||
RUN mkdir -p /code/log /code/test_case /code/upload
|
RUN mkdir -p /code/log /code/test_case /code/upload
|
||||||
|
RUN chown -R nobody:nogroup /code/log /code/test_case /code/upload
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
ADD requirements.txt /code/
|
ADD requirements.txt /code/
|
||||||
RUN pip install -i http://pypi.douban.com/simple -r requirements.txt --trusted-host pypi.douban.com
|
RUN pip install -i http://pypi.douban.com/simple -r requirements.txt --trusted-host pypi.douban.com
|
||||||
EXPOSE 8010
|
RUN rm /etc/apt/sources.list
|
||||||
CMD supervisord
|
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
|
||||||
@ -1,16 +1,12 @@
|
|||||||
[program:gunicorn]
|
[program:gunicorn]
|
||||||
|
|
||||||
command=gunicorn oj.wsgi:application -b 0.0.0.0:8080 --reload
|
command=gunicorn oj.wsgi:application -b 0.0.0.0:8080 --reload
|
||||||
|
|
||||||
directory=/code/
|
directory=/code/
|
||||||
user=root
|
user=nobody
|
||||||
numprocs=1
|
numprocs=1
|
||||||
stdout_logfile=/code/log/gunicorn.log
|
stdout_logfile=/code/log/gunicorn.log
|
||||||
stderr_logfile=/code/log/gunicorn.log
|
stderr_logfile=/code/log/gunicorn.log
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
startsecs=5
|
startsecs=5
|
||||||
|
|
||||||
stopwaitsecs = 6
|
stopwaitsecs = 6
|
||||||
|
|
||||||
killasgroup=true
|
killasgroup=true
|
||||||
4
dockerfiles/oj_web_server/run.sh
Normal file
4
dockerfiles/oj_web_server/run.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
find /code -name "*.pyc" -delete
|
||||||
|
python -m compileall /code
|
||||||
|
exec supervisord
|
||||||
@ -1,26 +1,21 @@
|
|||||||
[unix_http_server]
|
[unix_http_server]
|
||||||
file=/tmp/supervisor.sock ; path to your socket file
|
file=/tmp/supervisor.sock
|
||||||
|
|
||||||
[supervisord]
|
[supervisord]
|
||||||
logfile=/code/log/supervisord.log ; supervisord log file
|
logfile=/code/log/supervisord.log
|
||||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
logfile_maxbytes=50MB
|
||||||
logfile_backups=10 ; number of backed up logfiles
|
logfile_backups=10
|
||||||
loglevel=info ; info, debug, warn, trace
|
loglevel=info
|
||||||
pidfile=/code/log/supervisord.pid ; pidfile location
|
pidfile=/code/log/supervisord.pid
|
||||||
nodaemon=true ; run supervisord as a daemon
|
nodaemon=true
|
||||||
minfds=1024 ; number of startup file descriptors
|
minfds=1024
|
||||||
minprocs=200 ; number of process descriptors
|
minprocs=200
|
||||||
user=root ; default user
|
user=nobody
|
||||||
childlogdir=/code/log/ ; where child log files will live
|
childlogdir=/code/log/
|
||||||
|
|
||||||
|
|
||||||
[rpcinterface:supervisor]
|
[rpcinterface:supervisor]
|
||||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
[supervisorctl]
|
[supervisorctl]
|
||||||
serverurl=unix:///tmp/supervisor.sock ; use unix:// schem for a unix sockets.
|
serverurl=unix:///tmp/supervisor.sock
|
||||||
|
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
|
|
||||||
files=gunicorn.conf task_queue.conf
|
files=gunicorn.conf task_queue.conf
|
||||||
@ -1,16 +1,12 @@
|
|||||||
[program:task_queue]
|
[program:task_queue]
|
||||||
|
|
||||||
command=python manage.py celeryd -B -l DEBUG
|
command=python manage.py celeryd -B -l DEBUG
|
||||||
|
|
||||||
directory=/code/
|
directory=/code/
|
||||||
user=root
|
user=nobody
|
||||||
numprocs=1
|
numprocs=1
|
||||||
stdout_logfile=/code/log/task_queue.log
|
stdout_logfile=/code/log/task_queue.log
|
||||||
stderr_logfile=/code/log/task_queue.log
|
stderr_logfile=/code/log/task_queue.log
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
startsecs=5
|
startsecs=5
|
||||||
|
|
||||||
stopwaitsecs = 6
|
stopwaitsecs = 6
|
||||||
|
|
||||||
killasgroup=true
|
killasgroup=true
|
||||||
Loading…
Reference in New Issue
Block a user