chore: Dockerfile pip/uv 改用阿里云 PyPI 镜像源
This commit is contained in:
@@ -11,18 +11,18 @@ ENV UV_COMPILE_BYTECODE=1 \
|
||||
WORKDIR /app
|
||||
|
||||
# 安装 uv(pip 走 PyPI,通常国内服务器能访问;如果也慢可换阿里源)
|
||||
RUN pip install --no-cache-dir uv
|
||||
RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ uv
|
||||
|
||||
# 先复制锁定文件,利用 Docker 缓存层
|
||||
COPY requirements.lock pyproject.toml ./
|
||||
|
||||
# 创建虚拟环境并安装依赖
|
||||
RUN uv venv /opt/venv && \
|
||||
uv pip sync --python /opt/venv/bin/python requirements.lock
|
||||
uv pip sync --index-url https://mirrors.aliyun.com/pypi/simple/ --python /opt/venv/bin/python requirements.lock
|
||||
|
||||
# 复制应用代码并安装
|
||||
COPY app/ ./app/
|
||||
RUN uv pip install --python /opt/venv/bin/python --no-deps -e .
|
||||
RUN uv pip install --index-url https://mirrors.aliyun.com/pypi/simple/ --python /opt/venv/bin/python --no-deps -e .
|
||||
|
||||
# ===== 生产镜像 =====
|
||||
FROM python:3.13-slim AS production
|
||||
|
||||
Reference in New Issue
Block a user