docker启动的时候创建密钥和生成数据库

This commit is contained in:
virusdefender
2016-02-20 13:57:14 +08:00
parent cd123d2cdf
commit ac2b2445b5
3 changed files with 38 additions and 3 deletions

View File

@@ -1,5 +1,12 @@
#!/usr/bin/env bash
if [ ! -f "/code/oj/custom_settings.py" ]; then
cp /code/oj/custom_settings.example.py /code/oj/custom_settings.py
echo "SECRET_KEY=\"`cat /dev/urandom | head -1 | md5sum | head -c 32`\"" >> /code/oj/custom_settings.py
fi
find /code -name "*.pyc" -delete
python -m compileall /code
chown -R nobody:nogroup /code/log /code/test_case /code/upload
echo "Waiting MySQL and Redis to start"
sleep 10
python /code/tools/create_db.py
exec supervisord