Bootstrap pip via ensurepip in builder stage
python:3.11-slim has neither curl nor pip. Using ensurepip to get pip, then pip install uv from the local registry mirror. This avoids any network dependency on pypi.org or astral.sh. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
+8
-5
@@ -14,12 +14,15 @@ FROM python:3.11-slim AS builder
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install uv — download the pre-built binary directly from GitHub releases
|
# python:3.11-slim has neither curl nor pip. Bootstrap pip via ensurepip,
|
||||||
# and add it to PATH for this layer.
|
# then use it to install uv from the local PyPI mirror.
|
||||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
RUN python -m ensurepip --upgrade \
|
||||||
&& . /usr/local/env 2>/dev/null || true
|
&& python -m pip install --break-system-packages \
|
||||||
|
--index-url https://pypi.reg.darano.ir/simple/ \
|
||||||
|
--trusted-host pypi.reg.darano.ir \
|
||||||
|
uv
|
||||||
|
|
||||||
ENV PATH="/root/.local/bin:$PATH" \
|
ENV PATH="/usr/local/bin:$PATH" \
|
||||||
UV_DEFAULT_INDEX="https://pypi.reg.darano.ir"
|
UV_DEFAULT_INDEX="https://pypi.reg.darano.ir"
|
||||||
|
|
||||||
COPY pyproject.toml uv.lock* ./
|
COPY pyproject.toml uv.lock* ./
|
||||||
|
|||||||
Reference in New Issue
Block a user