leonsimon23 commited on
Commit
158cda9
·
verified ·
1 Parent(s): ce6b06d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -8
Dockerfile CHANGED
@@ -1,21 +1,27 @@
1
  # syntax=docker/dockerfile:1.4
2
  FROM python:3.9-slim
3
 
 
 
 
4
  # 设置工作目录
5
  WORKDIR /app
6
 
7
- # 安装必要的依赖
8
- RUN apt-get update && apt-get install -y git
 
 
 
9
 
10
- # 使用 GitHub 令牌克隆私有仓库
11
- RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444 \
12
- git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/sci_xg_classify.git .
13
 
14
  # 安装 Python 依赖
15
- RUN pip install -r requirements.txt
16
 
17
- # 暴露 Streamlit 运行的端口
18
  EXPOSE 8051
19
 
20
  # 启动 Streamlit 应用
21
- CMD ["streamlit", "run", "app.py", "--server.port=8051", "--server.address=0.0.0.0", "--server.enableCORS=false"]
 
1
  # syntax=docker/dockerfile:1.4
2
  FROM python:3.9-slim
3
 
4
+ # 安装必要依赖
5
+ RUN apt-get update && apt-get install -y git
6
+
7
  # 设置工作目录
8
  WORKDIR /app
9
 
10
+ # 使用 ARG 传入 GitHub 令牌(在构建时传入)
11
+ ARG GITHUB_TOKEN
12
+
13
+ # 克隆私有仓库
14
+ RUN git clone https://x-access-token:${GITHUB_TOKEN}@github.com/leoncool23/sci_xg_classify.git .
15
 
16
+ # 设置 Matplotlib 配置目录
17
+ ENV MPLCONFIGDIR=/tmp/.matplotlib
18
+ RUN mkdir -p /tmp/.matplotlib && chmod -R 777 /tmp/.matplotlib
19
 
20
  # 安装 Python 依赖
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # 暴露端口
24
  EXPOSE 8051
25
 
26
  # 启动 Streamlit 应用
27
+ CMD ["streamlit", "run", "app.py", "--server.port=8051", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]