jung-ming commited on
Commit
2dde67d
·
verified ·
1 Parent(s): a8c37b4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -13
Dockerfile CHANGED
@@ -1,27 +1,17 @@
1
  FROM python:3.10-slim
2
 
3
- # 安裝中文字型(含 Noto CJK)
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  fonts-noto-cjk \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # 設定工作目錄
9
  WORKDIR /app
10
-
11
- # 複製 requirements
12
  COPY requirements.txt .
13
-
14
- # 安裝 Python 套件
15
  RUN pip install --no-cache-dir -r requirements.txt
16
-
17
- # 複製全部程式碼
18
  COPY . .
19
 
20
- # 👉 更新 matplotlib 字型快取(關鍵!)
21
- RUN python -c "import matplotlib; matplotlib.font_manager._rebuild()"
22
 
23
- # 開放 port
24
  EXPOSE 8501
25
-
26
- # 執行 Streamlit
27
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 安裝中文字型
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  fonts-noto-cjk \
6
  && rm -rf /var/lib/apt/lists/*
7
 
 
8
  WORKDIR /app
 
 
9
  COPY requirements.txt .
 
 
10
  RUN pip install --no-cache-dir -r requirements.txt
 
 
11
  COPY . .
12
 
13
+ # 避免 matplotlib 權限錯誤
14
+ ENV MPLCONFIGDIR=/tmp/matplotlib_cache
15
 
 
16
  EXPOSE 8501
 
 
17
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]