Files
usa/scripts/production-start.sh

22 lines
899 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 生产环境一键:构建爬虫镜像 + 以「仅爬虫 Docker、API 在宿主机」方式启动,并输出数据对齐说明。
# 使用前API 已用 PM2 等方式在宿主机 3001 端口运行,且 server/data.db 已存在(或先执行 npm run api:seed
set -e
cd "$(dirname "$0")/.."
PROJECT_ROOT="${PROJECT_ROOT:-$(pwd)}"
REGISTRY="${REGISTRY:-}"
echo "==> Building crawler image..."
docker build -t usa-dashboard-crawler:latest \
${REGISTRY:+--build-arg REGISTRY="$REGISTRY"} \
-f Dockerfile.crawler .
echo ""
./scripts/run-crawler-docker-standalone.sh
echo ""
echo "==> Data alignment (生产数据对齐)"
echo " API (host) DB_PATH = $PROJECT_ROOT/server/data.db (或 env DB_PATH)"
echo " Crawler /data/data.db = 挂载自上述同一文件"
echo " 二者必须指向同一 SQLite 文件,前端/API 与爬虫才能数据一致。"