Files
ewoooc/Dockerfile
OoO 38967ceea3
All checks were successful
CD Pipeline / deploy (push) Successful in 13m18s
feat(ppt): redesign all 6 reports to professional standard + cache versioning
PPT 模板全面升版至市場專業標準(McKinsey / BCG 月報級別):

Monthly v3.1(10 頁)
- 暖紙感封面(去黑底)+ elevator pitch(亮點/警訊/動能徽章)
- KPI 卡含 △% vs 上月 + 紅綠燈、YoY 同期對比帶
- matplotlib 業績趨勢折線(本月+上月+日均線+高低點)
- 品類分析雙視圖:橫條 + 帕雷托累計(80% 主力線)
- TOP 50 商品(自動分頁)+ vs 上月 △ 排名變化 / 🆕 新進榜
- MCP 情報 4 卡片結構化、AI 行動結構化分區、附錄頁

Daily / Weekly / Strategy / Promo / Competitor v3.0
- 統一暖紙封面、AI 頁去黑底改暖紙 + 焦糖橘色條
- 日週改 matplotlib 折線(含日均線、高低點)
- 全部加附錄頁(資料來源 / 計算口徑 / 模板版本)

Cache 版本控制
- TEMPLATE_VERSIONS 字典自動注入 cache key (tpl_ver)
- 模板升版舊快取自動 miss → 重生
- 新增 _invalidate_ppt_cache() 與 cleanup_expired_ppt_cache() helper
- 新增 /cache status / flush / cleanup Telegram 指令

字型系統
- _set_run_fonts() 用 lxml 直寫 a:latin/a:ea,中英分軌
- 中文走 Microsoft JhengHei,數字/英文走 Consolas(點陣等寬)
- Dockerfile 加 fonts-noto-cjk + fonts-noto-cjk-extra

部署排程
- scripts/install_ppt_cleanup.sh 一鍵安裝 launchd(每日 03:15)
- scripts/ppt_cleanup.sh 清 7 天前過期 PPT 檔 + DB row

資料層
- routes monthly: query_monthly_summary LIMIT 10 → 50,補 orders 欄位
- routes monthly: 拉 prev_month / prev_year 比較資料供 KPI △ 與商品 △ 計算

煙霧測試 6/6 全綠:
- 日報 v3.0 (5 頁) / 週報 v3.0 (6 頁) / 月報 v3.1 (10 頁)
- 策略 v3.0 (6 頁) / 促銷 v3.0 (6 頁) / 競品 v3.0 (5 頁)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:26:27 +08:00

71 lines
1.9 KiB
Docker
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.
FROM python:3.11-slim
# 設定工作目錄
WORKDIR /app
# 安裝系統依賴 (包含 PostgreSQL 客戶端庫 + Chrome/Selenium 依賴)
# 注意Debian Trixie 已移除 libgconf-2-4改用 libglib2.0-0
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
libpq-dev \
# Chrome/Selenium 依賴
wget \
gnupg \
unzip \
libnss3 \
libglib2.0-0 \
libfontconfig1 \
libx11-xcb1 \
libasound2t64 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
fonts-liberation \
fonts-noto-cjk \
fonts-noto-cjk-extra \
openssh-client \
libappindicator3-1 || true \
&& rm -rf /var/lib/apt/lists/*
# 安裝 Chrome (使用新版 GPG 金鑰管理方式apt-key 已被移除)
RUN mkdir -p /etc/apt/keyrings \
&& wget -q -O /etc/apt/keyrings/google-chrome.asc https://dl.google.com/linux/linux_signing_key.pub \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.asc] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# 複製 requirements
COPY requirements.txt .
# 安裝 Python 依賴
RUN pip install --no-cache-dir -r requirements.txt
# 複製應用程式
COPY . .
# 建立必要的目錄
RUN mkdir -p data logs backups
# 確保 components symlink 正確(根目錄頁面需要此路徑)
RUN rm -rf /app/components && ln -sf /app/templates/components /app/components
# 設定環境變數
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=app.py
# 暴露端口(容器內 app 綁 80docker-compose / k8s 對外映射依環境而定)
EXPOSE 80
# 啟動應用production 用 gunicornpreload + post_fork DB pool reset 見 gunicorn.conf.py
CMD ["gunicorn", "--config", "gunicorn.conf.py", "app:app"]