更新镜像和启动脚本

This commit is contained in:
ngfchl
2022-10-10 13:24:11 +08:00
parent e55c9e1ce7
commit 36444837f2
2 changed files with 40 additions and 55 deletions

View File

@@ -7,34 +7,32 @@ else
fi
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
echo "-- First container startup --"
echo "升级pip"
python -m pip install --upgrade pip
# 此处插入你要执行的命令或者脚本文件
echo "下载PTools代码"
git init &&
git remote add origin https://gitee.com/ngfchl/ptools &&
# 此处插入你要执行的命令或者脚本文件
echo "升级pip"
python -m pip install --upgrade pip
echo "拉取PTools最新代码"
# 设置拉取最新文件并覆盖
git config pull.ff only &&
git config pull.ff only
git pull origin $DEV
echo "列出代码文件信息"
ls -l && pwd
echo "安装pip依赖"
pip install -r requirements.txt -U
echo "初始化数据库"
python manage.py makemigrations
python manage.py migrate
python manage.py loaddata pt.json
echo "创建超级用户"
DJANGO_SUPERUSER_USERNAME=$DJANGO_SUPERUSER_USERNAME \
DJANGO_SUPERUSER_EMAIL=$DJANGO_SUPERUSER_EMAIL \
DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD \
echo "列出代码文件信息"
ls -l
echo "安装pip依赖"
pip install -r requirements.txt
echo "初始化数据库"
python manage.py makemigrations
python manage.py migrate
python manage.py loaddata pt.json
touch $CONTAINER_ALREADY_STARTED
echo "创建超级用户"
DJANGO_SUPERUSER_USERNAME=$DJANGO_SUPERUSER_USERNAME
DJANGO_SUPERUSER_EMAIL=$DJANGO_SUPERUSER_EMAIL
DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD
python manage.py createsuperuser --noinput
echo "初始化完成"
touch $CONTAINER_ALREADY_STARTED
echo "初始化完成"
else
echo "-- Not first container startup --"
fi
echo "写入U2 hosts"
echo 172.64.153.252 u2.dmhy.org >>/etc/hosts
echo "写入U2 hosts"
echo 172.64.153.252 u2.dmhy.org >>/etc/hosts
echo "启动服务"
python manage.py runserver 0.0.0.0:$DJANGO_WEB_PORT
python manage.py runserver 0.0.0.0:$DJANGO_WEB_PORT