From 6e0ccb3b58c74e170fde0c02595b4485b2498318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=99=93=E4=BC=9F?= Date: Fri, 20 Dec 2024 15:11:29 +0800 Subject: [PATCH] :wrench: cn mirrors --- Dockerfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6395f53..ef626e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,12 @@ # 使用更轻量级的 Python 基础镜像 FROM python:3.13-slim AS builder +# cn: --build-arg APT_DOMAIN=mirrors.aliyun.com +ARG APT_DOMAIN=deb.debian.org +# cn: --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple +ARG PIP_INDEX_URL=https://pypi.org/simple +ENV PIP_INDEX_URL=${PIP_INDEX_URL} + # 设置工作目录 WORKDIR /app @@ -8,7 +14,8 @@ WORKDIR /app COPY requirements.txt . # 安装构建依赖和 Python 包 -RUN apt-get update && \ +RUN sed -i "s#deb.debian.org#$APT_DOMAIN#" /etc/apt/sources.list.d/debian.sources && \ + apt-get update && \ apt-get install -y --no-install-recommends \ gcc \ python3-dev \ @@ -26,6 +33,9 @@ ARG MODEL ARG PROMPT ARG FILE_DELETE_DELAY +# cn: --build-arg APT_DOMAIN=mirrors.aliyun.com +ARG APT_DOMAIN=deb.debian.org + # 设置环境变量 ENV API_KEY=${API_KEY} \ BASE_URL=${BASE_URL} \ @@ -37,7 +47,8 @@ ENV API_KEY=${API_KEY} \ WORKDIR /app # 只安装运行时必需的系统依赖 -RUN apt-get update && \ +RUN sed -i "s#deb.debian.org#$APT_DOMAIN#" /etc/apt/sources.list.d/debian.sources && \ + apt-get update && \ apt-get install -y --no-install-recommends \ ffmpeg \ && \ -- Gitee