db / run.sh
aigenai's picture
Update run.sh
fd8cdbb verified
raw
history blame
593 Bytes
#!/bin/bash
echo "============"
whoami
cat /etc/passwd
echo "============"
# 确保以 postgres 用户身份运行
if [ "$(id -u)" -ne 1000 ]; then
echo "切换到 UID 为 1000 的 postgres 用户运行"
exec gosu postgres "$0" "$@"
fi
# 启动 PostgreSQL 服务
docker-entrypoint.sh postgres &
# 检查 PostgreSQL 服务是否已启动
echo "等待 PostgreSQL 服务启动..."
until pg_isready -h localhost; do
sleep 2
done
echo "PostgreSQL 服务已启动!"
# 启动 Flask 应用,确保使用虚拟环境中的 Python
echo "启动 Flask 应用..."
$VIRTUAL_ENV/bin/python app.py