Spaces:
Paused
Paused
File size: 717 Bytes
0177a34 b1efd46 0177a34 ae6e461 f99169e 0177a34 f99169e b1efd46 f99169e b1efd46 f99169e 0177a34 28b6ebb 0177a34 28b6ebb d6878ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 使用官方的 uv 基础镜像
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
# 设置工作目录
WORKDIR /app
# 为 uv 设置缓存目录(我们继续尝试使用此命令进行缓存修复)
ENV UV_CACHE_DIR=/app/.uv-cache
RUN mkdir -p $UV_CACHE_DIR && chown -R $(id -u):$(id -g) $UV_CACHE_DIR
# 安装依赖
# 首先只复制依赖文件
COPY pyproject.toml .
# 使用 `uv pip install .` 安装依赖,读取 pyproject.toml
# --- 修改的 RUN 命令 ---
RUN uv pip install --system .
# --- 修改命令结束 ---
# 复制应用程序代码
COPY . .
# 暴露应用程序运行的端口
EXPOSE 8000
# 运行应用程序的命令
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|