build: use mainland package mirrors
This commit is contained in:
+8
-5
@@ -5,11 +5,13 @@ USER root
|
||||
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
|
||||
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
||||
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}
|
||||
ENV BUN_CONFIG_REGISTRY=${NPM_REGISTRY}
|
||||
|
||||
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 && \
|
||||
@@ -19,14 +21,14 @@ RUN sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http:/
|
||||
unzip \
|
||||
python3 \
|
||||
python3-venv && \
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
||||
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" \
|
||||
python3 -m venv "$VIRTUAL_ENV" && \
|
||||
pip install \
|
||||
--index-url "$PIP_INDEX_URL" \
|
||||
--trusted-host "$PIP_TRUSTED_HOST" \
|
||||
uv \
|
||||
pip \
|
||||
setuptools \
|
||||
wheel \
|
||||
@@ -37,6 +39,7 @@ RUN sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http:/
|
||||
rich \
|
||||
ipython \
|
||||
pytest && \
|
||||
ln -s "$VIRTUAL_ENV/bin/uv" /usr/local/bin/uv && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=bun-bin /usr/local/bin/bun /usr/local/bin/bun
|
||||
|
||||
Reference in New Issue
Block a user