Update run.sh
Browse files
run.sh
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
#!/bin/bash
|
2 |
-
whoami
|
3 |
-
which python3
|
4 |
-
cat /etc/passwd
|
5 |
|
6 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
docker-entrypoint.sh postgres &
|
8 |
|
9 |
# 检查 PostgreSQL 服务是否已启动
|
@@ -15,4 +18,4 @@ echo "PostgreSQL 服务已启动!"
|
|
15 |
|
16 |
# 启动 Flask 应用,确保使用虚拟环境中的 Python
|
17 |
echo "启动 Flask 应用..."
|
18 |
-
$VIRTUAL_ENV/bin/python app.py
|
|
|
1 |
#!/bin/bash
|
|
|
|
|
|
|
2 |
|
3 |
+
# 确保以 postgres 用户身份运行
|
4 |
+
if [ "$(id -u)" -ne 1000 ]; then
|
5 |
+
echo "切换到 UID 为 1000 的 postgres 用户运行"
|
6 |
+
exec gosu postgres "$0" "$@"
|
7 |
+
fi
|
8 |
+
|
9 |
+
# 启动 PostgreSQL 服务
|
10 |
docker-entrypoint.sh postgres &
|
11 |
|
12 |
# 检查 PostgreSQL 服务是否已启动
|
|
|
18 |
|
19 |
# 启动 Flask 应用,确保使用虚拟环境中的 Python
|
20 |
echo "启动 Flask 应用..."
|
21 |
+
$VIRTUAL_ENV/bin/python app.py
|