nbugs commited on
Commit
b1858b2
·
verified ·
1 Parent(s): d696836

Create entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +20 -0
entrypoint.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # entrypoint.sh
3
+
4
+ # 设置脚本在出错时退出
5
+ set -e
6
+
7
+ echo "容器入口点脚本启动..."
8
+
9
+ # 在后台启动数据同步脚本
10
+ echo "启动后台同步脚本 (/app/sync_data.sh)..."
11
+ /app/sync_data.sh &
12
+
13
+ # 等待一小段时间,确保后台进程有时间启动(可选,但有时有帮助)
14
+ sleep 2
15
+
16
+ echo "执行原始容器命令..."
17
+ # 执行传递给入口点脚本的命令 (通常是 Dockerfile 中的 CMD)
18
+ # 例如,如果原始 CMD 是 ["/app/start.sh"],这里就会执行 /app/start.sh
19
+ # 如果原始 CMD 是 ["python", "backend/main.py"],这里就会执行 python backend/main.py
20
+ exec "$@"