ouux commited on
Commit
2f6bdaf
·
verified ·
1 Parent(s): 1b0a26a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -10
Dockerfile CHANGED
@@ -1,21 +1,17 @@
1
- # 基础镜像Python 3.14
2
  FROM python:3.14-slim
3
 
4
  WORKDIR /app
5
 
6
- # 系统依赖
7
  RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
8
 
9
- # -------------------------------------------------
10
- # ① 先安装仅 CPU 的 PyTorch(兼容 Python 3.14)
11
- # -------------------------------------------------
12
  RUN pip install --no-cache-dir \
13
  torch==2.9.1+cpu \
14
  --index-url https://download.pytorch.org/whl/cpu
15
 
16
- # -------------------------------------------------
17
- # ② 再安装其余依赖(普通 PyPI)
18
- # -------------------------------------------------
19
  RUN pip install --no-cache-dir \
20
  transformers \
21
  tokenizers \
@@ -27,10 +23,10 @@ RUN pip install --no-cache-dir \
27
 
28
  # 复制应用代码
29
  COPY app.py ./
30
-
31
- # 让脚本可执行(可选)
32
  RUN chmod 777 app.py
33
 
 
34
  EXPOSE 8000
35
 
 
36
  CMD ["python", "app.py"]
 
1
+ # 基础镜像 Python 3.14
2
  FROM python:3.14-slim
3
 
4
  WORKDIR /app
5
 
6
+ # 安装基础工具
7
  RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
8
 
9
+ # 1.‌ 安装 CPU 版 PyTorch (兼容 Python 3.14)
 
 
10
  RUN pip install --no-cache-dir \
11
  torch==2.9.1+cpu \
12
  --index-url https://download.pytorch.org/whl/cpu
13
 
14
+ # 2.‌ 安装其余依赖
 
 
15
  RUN pip install --no-cache-dir \
16
  transformers \
17
  tokenizers \
 
23
 
24
  # 复制应用代码
25
  COPY app.py ./
 
 
26
  RUN chmod 777 app.py
27
 
28
+ # 暴露端口
29
  EXPOSE 8000
30
 
31
+ # 启动命令
32
  CMD ["python", "app.py"]