File size: 975 Bytes
ab7be27
 
 
 
786e5e3
 
bb36c60
786e5e3
 
bb36c60
ac303b3
 
 
 
 
 
 
 
 
 
786e5e3
 
ac303b3
bb36c60
786e5e3
 
 
 
 
 
 
 
 
 
550f045
0ac550d
550f045
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

set -e

run_script() {
    echo "开始执行脚本"

    # 设置代理
    export https_proxy=$PROXY http_proxy=$PROXY all_proxy=$PROXY

    # 检查 aggregator 目录是否存在,如果不存在则克隆
    if [ ! -d "/app/aggregator" ]; then
        echo "克隆 aggregator 仓库"
        if [ "${GIT_CLONE_PROXY}" = "1" ]; then
            git clone https://mirror.ghproxy.com/https://github.com/wzdnzd/aggregator.git /app/aggregator
        else
            git clone https://github.com/wzdnzd/aggregator.git /app/aggregator
        fi
    fi

    # 运行代码
    echo "运行 collect.py"
    python -u /app/aggregator/subscribe/collect.py -si

    echo "运行 merged2upload.py"
    python /app/merged2upload.py
}

# 立即运行一次脚本
run_script

# 启动调度器
python /app/scheduler.py &

# 启动一个简单的 HTTP 服务器来保持容器运行并响应健康检查
echo "启动 HTTP 服务器在端口 8080"
python -m http.server 8080