ceshidddyyy / entrypoint.sh
xjf6b's picture
Update entrypoint.sh
550f045 verified
raw
history blame
996 Bytes
#!/bin/sh
set -e
run_script() {
echo "开始执行脚本"
# 确保我们在正确的目录
cd /app
# clone 代码
if [ "${GIT_CLONE_PROXY}" = "1" ]; then
echo "克隆 aggregator(使用 ghproxy 代理)"
git clone https://mirror.ghproxy.com/https://github.com/wzdnzd/aggregator.git
else
echo "克隆 aggregator"
git clone https://github.com/wzdnzd/aggregator.git
fi
# 设置代理
export https_proxy=$PROXY http_proxy=$PROXY all_proxy=$PROXY
# 运行代码
echo "运行 collect.py"
cd /app/aggregator && python -u subscribe/collect.py -si
echo "运行 merged2upload.py"
python /app/merged2upload.py
# 清理克隆的代码
cd /app && rm -rf aggregator
}
# 立即运行一次脚本
run_script
# 启动调度器
python /app/scheduler.py &
# 启动一个简单的 HTTP 服务器来保持容器运行并响应健康检查
echo "启动 HTTP 服务器在端口 8080"
python -m http.server 8080