更新 docker 打包,增加 python 运行环境
This commit is contained in:
+36
-2
@@ -1,8 +1,42 @@
|
|||||||
FROM smanx/opencode:latest AS base
|
FROM smanx/opencode:latest AS base
|
||||||
USER root
|
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 && \
|
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
|
FROM base AS deps
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user