feat: init project
This commit is contained in:
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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", "crawler.py"]
|
Reference in New Issue
Block a user