Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +23 -0
Dockerfile
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 基础镜像
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# 安装基础依赖
|
5 |
+
RUN apt-get update && apt-get install -y git curl && apt-get clean
|
6 |
+
|
7 |
+
# 安装 PyTorch
|
8 |
+
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
9 |
+
|
10 |
+
# 复制 requirements.txt
|
11 |
+
COPY requirements.txt /tmp/requirements.txt
|
12 |
+
|
13 |
+
# 安装其他依赖项
|
14 |
+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
15 |
+
|
16 |
+
# 复制代码
|
17 |
+
COPY . /app
|
18 |
+
|
19 |
+
# 设置工作目录
|
20 |
+
WORKDIR /app
|
21 |
+
|
22 |
+
# 启动命令
|
23 |
+
CMD ["python", "app.py"]
|