Files
stock-info-crawler/Dockerfile
MH Hung 099f156e6f feat(email): add SMTP security modes (starttls/ssl/none) with sensible default ports; add /notify_test endpoint; support ALWAYS_NOTIFY_ON_STARTUP to force first-run notification
chore(docker): run enhanced_crawler.py as entrypoint

ops(compose): load env via env_file and remove hardcoded secrets

docs: update README and .env.template for SMTP and startup notification
2025-09-03 21:32:50 +08:00

37 lines
708 B
Docker
Raw 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.

# 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", "enhanced_crawler.py"]