From 59de5c672fde15e8463014871040ff1e89bbfa5d Mon Sep 17 00:00:00 2001 From: Huarch Date: Mon, 11 May 2026 18:14:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20docker=20=E6=89=93?= =?UTF-8?q?=E5=8C=85=EF=BC=8C=E5=A2=9E=E5=8A=A0=20python=20=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d340f0..f1fd8e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,42 @@ FROM smanx/opencode:latest AS base USER root -RUN apt-get update && apt-get install -y curl unzip && \ +ARG UBUNTU_APT_MIRROR=mirrors.aliyun.com +ARG PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple +ARG PYPI_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:/root/.local/bin:$PATH" +ENV PIP_INDEX_URL=${PYPI_INDEX_URL} +ENV PIP_TRUSTED_HOST=${PYPI_TRUSTED_HOST} +ENV UV_INDEX_URL=${PYPI_INDEX_URL} + +RUN sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http://security.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g" /etc/apt/sources.list 2>/dev/null || true && \ + sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http://security.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g" /etc/apt/sources.list.d/*.sources 2>/dev/null || true && \ + apt-get update && apt-get install -y --no-install-recommends \ + curl \ + unzip \ + python3 \ + python3-venv && \ + curl -LsSf https://astral.sh/uv/install.sh | sh && \ curl -fsSL https://bun.sh/install | bash && \ - ln -s /root/.bun/bin/bun /usr/local/bin/bun + ln -s /root/.bun/bin/bun /usr/local/bin/bun && \ + ln -s /root/.local/bin/uv /usr/local/bin/uv && \ + ln -sf /usr/bin/python3 /usr/local/bin/python && \ + mkdir -p /root/.config/pip && \ + printf "[global]\nindex-url = %s\ntrusted-host = %s\n" "$PIP_INDEX_URL" "$PIP_TRUSTED_HOST" > /root/.config/pip/pip.conf && \ + uv venv "$VIRTUAL_ENV" && \ + uv pip install --python "$VIRTUAL_ENV/bin/python" \ + --index-url "$UV_INDEX_URL" \ + pip \ + setuptools \ + wheel \ + requests \ + httpx \ + pydantic \ + python-dotenv \ + rich \ + ipython \ + pytest && \ + rm -rf /var/lib/apt/lists/* FROM base AS deps