#!/bin/bash # # uoj-db image preparation. Runs at *build* time and only stages files for # the mysql entrypoint, which executes /docker-entrypoint-initdb.d/* on the # first start (i.e. when ./uoj_data/db/mysql is empty). set -eu setLAMPConf(){ printf "\n\n==> Setting mysqld config\n" # NOTE: the previous version wrote `init_connect` twice; mysqld keeps only # the last occurrence, so the connection charset was never applied. cat >/etc/mysql/conf.d/uoj_mysqld.cnf < Staging database init scripts\n" cat >/docker-entrypoint-initdb.d/000-native_password.sql <&2 exit 1 fi done # 001 is the current schema (30 tables, includes the WyOJ additions: # songs / pastes / rp / datum_* and the extra user_info columns). # See ../docker-compose.seed.yml to import a full dump instead. cp app_uoj233.sql /docker-entrypoint-initdb.d/001-app_uoj233.sql cp add_judger.sql /docker-entrypoint-initdb.d/002-add_judger.sql ls -l /docker-entrypoint-initdb.d/ } echo 'Preparing UOJ System db environment...' setLAMPConf setWebConf