Merge branch 'develop'

This commit is contained in:
billchenchina 2020-07-14 13:39:58 +00:00
commit 230738b770
2 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
FROM ubuntu:18.04 FROM ubuntu:20.04
MAINTAINER MascoSkray <MascoSkray@gmail.com> MAINTAINER MascoSkray <MascoSkray@gmail.com>
ARG CLONE_ADDFLAG ARG CLONE_ADDFLAG

View File

@ -18,7 +18,9 @@ getAptPackage(){
echo "deb http://ppa.launchpad.net/stesie/libv8/ubuntu bionic main" | tee /etc/apt/sources.list.d/stesie-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D858A0DF echo "deb http://ppa.launchpad.net/stesie/libv8/ubuntu bionic main" | tee /etc/apt/sources.list.d/stesie-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D858A0DF
apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring mysql-server cmake fp-compiler re2c libv8-7.5-dev libyaml-dev python python3 python3-requests openjdk-8-jdk openjdk-11-jdk apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring mysql-server cmake fp-compiler re2c libv8-7.5-dev libyaml-dev python python3 python3-requests openjdk-8-jdk openjdk-11-jdk
#Install PHP extensions #Install PHP extensions
printf "/opt/libv8-7.5\n\n" | pecl install v8js yaml yes | pecl install yaml
git clone https://github.com/phpv8/v8js.git --depth=1 /tmp/pear/download/v8js-master && cd /tmp/pear/download/v8js-master
phpize && ./configure --with-php-config=/usr/bin/php-config --with-v8js=/opt/libv8-7.5 && make install && cd -
} }
setLAMPConf(){ setLAMPConf(){
@ -47,7 +49,7 @@ UOJEOF
a2enmod rewrite headers && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf a2enmod rewrite headers && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
#Create UOJ session save dir and make PHP extensions available #Create UOJ session save dir and make PHP extensions available
mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions
sed -i -e '865a\extension=v8js.so\nextension=yaml.so' /etc/php/7.2/apache2/php.ini sed -i -e '912a\extension=v8js.so\nextension=yaml.so' /etc/php/7.4/apache2/php.ini
#Set MySQL user directory and connection config #Set MySQL user directory and connection config
usermod -d /var/lib/mysql/ mysql usermod -d /var/lib/mysql/ mysql
cat >/etc/mysql/mysql.conf.d/uoj_mysqld.cnf <<UOJEOF cat >/etc/mysql/mysql.conf.d/uoj_mysqld.cnf <<UOJEOF
@ -58,7 +60,7 @@ collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4' init_connect='SET NAMES utf8mb4'
init_connect='SET collation_connection = utf8mb4_unicode_ci' init_connect='SET collation_connection = utf8mb4_unicode_ci'
skip-character-set-client-handshake skip-character-set-client-handshake
sql-mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
UOJEOF UOJEOF
} }
@ -77,6 +79,7 @@ UOJEOF
#Import MySQL database #Import MySQL database
service mysql restart service mysql restart
mysql -u root --password=$_database_password_ <../db/app_uoj233.sql mysql -u root --password=$_database_password_ <../db/app_uoj233.sql
echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$_database_password_';" | mysql -u root --password=$_database_password_
} }
setJudgeConf(){ setJudgeConf(){
@ -94,7 +97,7 @@ cd /opt/uoj/judger && chmod +x judge_client
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
#define UOJ_WORK_PATH "/opt/uoj/judger/uoj_judger" #define UOJ_WORK_PATH "/opt/uoj/judger/uoj_judger"
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804 #define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
#define UOJ_JUDGER_PYTHON3_VERSION "3.6" #define UOJ_JUDGER_PYTHON3_VERSION "3.8"
#define UOJ_JUDGER_FPC_VERSION "3.0.4" #define UOJ_JUDGER_FPC_VERSION "3.0.4"
UOJEOF UOJEOF
cd uoj_judger && make -j$(($(nproc) + 1)) cd uoj_judger && make -j$(($(nproc) + 1))