New crawler: app/crawlers/openinsider_top.py\n- Scrapes three pages (sales/purchases/officer purchases)\n- Filters rows with Value/Amount >= ,000,000 (configurable via INSIDER_MIN_AMOUNT)\n- Builds concise notifications; saves to data/openinsider_top.json Runner: support comma-separated CRAWLER_TYPE and new openinsider_top type\n- Accepts e.g., CRAWLER_TYPE=openinsider_top,openinsider,barrons\n- Preserves order, removes duplicates; warns on unknown types\n- Uses shared schedule: RUN_DAILY_AT or CHECK_INTERVAL; initial run per crawler Entrypoint: rename enhanced_crawler.py -> main.py\n- Update Dockerfile CMD and README references Config & docs:\n- Reorganize .env.template into clear sections with examples\n- Update .env with multi-crawler example and INSIDER_MIN_AMOUNT\n- README: document new crawler, usage, and multi-type CRAWLER_TYPE
37 lines
696 B
Docker
37 lines
696 B
Docker
# Dockerfile
|
||
FROM python:3.11-slim
|
||
|
||
# 設定工作目錄
|
||
WORKDIR /app
|
||
|
||
# 安裝系統依賴
|
||
RUN apt-get update && apt-get install -y \
|
||
curl \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 複製需求檔案
|
||
COPY requirements.txt .
|
||
|
||
# 安裝 Python 依賴
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# 複製應用程式檔案
|
||
COPY . .
|
||
|
||
# 創建資料目錄
|
||
RUN mkdir -p /app/data /app/logs
|
||
|
||
# 設定環境變數
|
||
ENV PYTHONPATH=/app
|
||
ENV PYTHONUNBUFFERED=1
|
||
|
||
# 健康檢查
|
||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||
CMD python health_check.py || exit 1
|
||
|
||
# 暴露端口(用於健康檢查 API)
|
||
EXPOSE 8080
|
||
|
||
# 執行爬蟲主程式
|
||
CMD ["python", "main.py"]
|