Skip to content

Commit 795ce1d

Browse files
committed
update uv
1 parent 9dfb0b1 commit 795ce1d

File tree

3 files changed

+83
-23
lines changed

3 files changed

+83
-23
lines changed

Dockerfile

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
# 使用官方 Python 基础镜像
2-
FROM python:3.11-slim-bookworm AS builder
3-
4-
# 安装 uv
5-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
6-
7-
# 设置工作目录
8-
WORKDIR /app
9-
10-
# 复制依赖文件
11-
COPY pyproject.toml uv.lock ./
12-
13-
# 导出依赖并安装到系统路径(或使用虚拟环境)
14-
# --system 标志允许直接安装在镜像的 Python 环境中,适合容器场景
15-
RUN uv sync --frozen --no-dev
16-
17-
# 最终镜像
181
FROM python:3.11-slim-bookworm
192

203
WORKDIR /app
214

22-
# 从构建阶段复制安装好的库
23-
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
24-
COPY --from=builder /usr/local/bin /usr/local/bin
25-
265
# 复制源代码
276
COPY . .
7+
uv install -i https://mirrors.aliyun.com/pypi/simple/ --no-cache-dir .
288

299
# 暴露端口
3010
EXPOSE 8000

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "dashscope-sdk-python"
33
version = "0.1.0"
44
description = "Add your description here"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = ">=3.11"
77
dependencies = [
88
"fastapi>=0.128.0",
99
"openai>=2.14.0",

0 commit comments

Comments
 (0)