S2OJ/install/bundle/Dockerfile
Masco Skray e0914a8f31 chore(install/bundle): let Dockerfile get current branch when building
Previous the branch in Dockerfile is specified manually in each branch.
But when someone want to change the branch or test they must modify it.
To make the process more intelligent, we will auto get the branch name.
And, to make the image smaller, we added --single-branch argument onto.
2019-04-20 10:51:03 +08:00

26 lines
871 B
Docker

FROM ubuntu:18.04
MAINTAINER MascoSkray <MascoSkray@gmail.com>
ARG CLONE_ADDFLAG
#Update apt and install git
RUN apt-get update && apt-get install -y git
#Clone the latest UOJ Community verison to local
RUN cd ~ && git clone https://github.com/UniversalOJ/UOJ-System.git --depth 1 --single-branch ${CLONE_ADDFLAG}
#Install environment and set startup script
RUN cd ~/UOJ-System/install/bundle && sh install.sh -p && echo "\
#!/bin/sh\n\
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld\n\
if [ ! -f \"/var/svn/.UOJSetupDone\" ]; then\n\
cd ~/UOJ-System/install/bundle && sh install.sh -i\n\
fi\n\
service ntp start\n\
service mysql start\n\
service apache2 start\n\
svnserve -d -r /var/svn\n\
su local_main_judger -c \"~/judge_client/judge_client start\"\n\
exec bash\n" >/root/up && chmod +x /root/up
ENV LANG=C.UTF-8 TZ=Asia/Shanghai
EXPOSE 80 3690
CMD /root/up