Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +20 -0
Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 使用官方Python基础镜像
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# 设置工作目录
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
RUN mkdir -p /app/images && \
|
8 |
+
chmod -R 777 /app
|
9 |
+
|
10 |
+
# 复制当前目录下的所有文件到容器的/app目录
|
11 |
+
COPY . .
|
12 |
+
|
13 |
+
# 安装所需的Python库
|
14 |
+
RUN pip install --no-cache-dir fastapi uvicorn httpx pydantic requests
|
15 |
+
|
16 |
+
# 设置环境变量(可选)
|
17 |
+
ENV PYTHONUNBUFFERED=1
|
18 |
+
|
19 |
+
# 运行main.py
|
20 |
+
CMD ["python", "main.py"]
|