diff --git a/build.sh b/build.sh index d9903816f..f34fbff97 100755 --- a/build.sh +++ b/build.sh @@ -1 +1,2 @@ docker build -t registry.cn-hangzhou.aliyuncs.com/qduoj/oj_web_server -f dockerfiles/oj_web_server/Dockerfile . +docker build -t registry.cn-hangzhou.aliyuncs.com/qduoj/judger -f dockerfiles/judger/Dockerfile . diff --git a/dockerfiles/judger/Dockerfile b/dockerfiles/judger/Dockerfile index 055a7b5eb..d221942ab 100644 --- a/dockerfiles/judger/Dockerfile +++ b/dockerfiles/judger/Dockerfile @@ -1,15 +1,37 @@ FROM ubuntu:16.04 ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get -y install software-properties-common python-software-properties python python-dev gcc g++ git libtool python-pip libseccomp-dev -RUN add-apt-repository -y ppa:webupd8team/java && echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections -RUN apt-get update && apt-get install -y oracle-java8-installer -RUN cd /tmp && git clone -b master https://github.com/QingdaoU/Judger && cd Judger && python setup.py install -RUN mkdir -p /var/judger/run/ && mkdir /var/judger/test_case/ && mkdir /var/judger/code/ -RUN chmod -R 777 /var/judger/run/ -COPY dockerfiles/judger/policy /var/judger/run/ +RUN apt-get update \ + && buildDeps=' \ + software-properties-common \ + python-software-properties \ + python-dev \ + git \ + libtool \ + python-pip \ + libtool \ + libseccomp-dev' \ + && apt-get -y install python gcc g++ python-pkg-resources $buildDeps\ + && add-apt-repository -y ppa:webupd8team/java \ + && echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections \ + && echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections \ + && apt-get update \ + && apt-get install -y oracle-java8-installer \ + && cd /tmp \ + && git clone -b master https://github.com/QingdaoU/Judger \ + && cd Judger \ + && python setup.py install \ + && pip install supervisor \ + && apt-get purge -y --auto-remove $buildDeps \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /var/judger/run/ \ + && mkdir /var/judger/test_case/ \ + && mkdir /var/judger/code/ \ + && chmod -R 777 /var/judger/run/ +COPY dockerfiles/judger/policy /var/judger/run COPY dockerfiles/judger/supervisord.conf /etc -RUN pip install supervisor ADD . /var/judger/code WORKDIR /var/judger/code/judge/ EXPOSE 8080 CMD bash /var/judger/code/dockerfiles/judger/run.sh + diff --git a/dockerfiles/judger/docker-compose.example.yml b/dockerfiles/judger/docker-compose.example.yml deleted file mode 100644 index b3a6441af..000000000 --- a/dockerfiles/judger/docker-compose.example.yml +++ /dev/null @@ -1,11 +0,0 @@ -judger: - image: qduoj/judger - volumes: - - /home/OnlineJudge:/var/judger/code - - /home/test_case:/var/judger/test_case - - /home/log:/var/judger/code/judge/log - environment: - - TZ=Asia/Shanghai - - rpc_token={YOUR_PASSWORD} - ports: - - "0.0.0.0:8085:8080" \ No newline at end of file diff --git a/dockerfiles/oj_web_server/Dockerfile b/dockerfiles/oj_web_server/Dockerfile index 56d191db8..af67de972 100644 --- a/dockerfiles/oj_web_server/Dockerfile +++ b/dockerfiles/oj_web_server/Dockerfile @@ -1,10 +1,12 @@ FROM ubuntu:16.04 ENV PYTHONBUFFERED 1 -RUN apt-get update && apt-get install -y nginx python-pip libmysqlclient-dev curl nodejs -RUN curl -sL https://deb.nodesource.com/setup | bash - -RUN apt-get install nodejs ADD . /code WORKDIR /code -RUN pip install -i https://pypi.douban.com/simple -r dockerfiles/oj_web_server/requirements.txt +RUN apt-get update \ + && apt-get install --no-install-recommends -y nginx python-pip \ + nodejs libmysqlclient-dev python-setuptools build-essential python-dev \ + && pip install -i https://pypi.douban.com/simple -r dockerfiles/oj_web_server/requirements.txt \ + && apt-get purge -y --auto-remove build-essential python-dev\ + && rm -rf /var/lib/apt/lists/* RUN python tools/release_static.py CMD bash /code/dockerfiles/oj_web_server/run.sh diff --git a/dockerfiles/oj_web_server/docker-compose-nginx.example.yml b/dockerfiles/oj_web_server/docker-compose-nginx.example.yml deleted file mode 100644 index c5747752c..000000000 --- a/dockerfiles/oj_web_server/docker-compose-nginx.example.yml +++ /dev/null @@ -1,10 +0,0 @@ -nginx: - image: nginx - volumes: - - /home/OnlineJudge/dockerfiles/oj_web_server/oj.conf:/etc/nginx/conf.d/default.conf - - /home/upload:/home/upload - - /home/OnlineJudge/:/home/OnlineJudge - links: - - oj_web_server:oj_web_server - ports: - - "0.0.0.0:80:80" diff --git a/dockerfiles/oj_web_server/docker-compose.example.yml b/dockerfiles/oj_web_server/docker-compose.example.yml deleted file mode 100644 index 4caf38e1a..000000000 --- a/dockerfiles/oj_web_server/docker-compose.example.yml +++ /dev/null @@ -1,26 +0,0 @@ -redis: - image: redis - volumes: - - /home/data/redis:/data -mysql: - image: mysql - volumes: - - /home/data/mysql:/var/lib/mysql - environment: - - MYSQL_ROOT_PASSWORD={YOUR_PASSWORD} -oj_web_server: - image: qduoj/oj_web_server - volumes: - - /home/OnlineJudge:/code - - /home/test_case:/code/test_case - - /home/upload:/code/upload - - /home/log:/code/log - links: - - redis:redis - - mysql:mysql - ports: - - "127.0.0.1:8080:8080" - environment: - - TZ=Asia/Shanghai - - oj_env=server - - MYSQL_ENV_MYSQL_USER=root \ No newline at end of file