ceshidddyyy / entrypoint.sh
xjf6b's picture
Update entrypoint.sh
ac303b3 verified
raw
history blame contribute delete
975 Bytes
#!/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