diff --git a/scripts/images/deer-flow-backend/Dockerfile b/scripts/images/deer-flow-backend/Dockerfile index 29011cd..afb7082 100644 --- a/scripts/images/deer-flow-backend/Dockerfile +++ b/scripts/images/deer-flow-backend/Dockerfile @@ -3,11 +3,19 @@ FROM ghcr.io/astral-sh/uv:python3.12-bookworm # Install uv. COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv -# Install system dependencies including libpq -RUN apt-get update && apt-get install -y \ +# 配置 apt 阿里云镜像源并安装系统依赖 +RUN if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + elif [ -f /etc/apt/sources.list ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list; \ + fi && \ + apt-get update && apt-get install -y \ libpq-dev git \ && rm -rf /var/lib/apt/lists/* - + +# 配置 uv 使用阿里云 PyPI 镜像 +ENV UV_INDEX_URL="https://mirrors.aliyun.com/pypi/simple/" + WORKDIR /app # Copy the application into the container. diff --git a/scripts/images/deer-flow-frontend/Dockerfile b/scripts/images/deer-flow-frontend/Dockerfile index 29f0ea7..99cb346 100644 --- a/scripts/images/deer-flow-frontend/Dockerfile +++ b/scripts/images/deer-flow-frontend/Dockerfile @@ -7,11 +7,12 @@ WORKDIR /app RUN git clone https://github.com/ModelEngine-Group/deer-flow.git /deer-flow \ && mv /deer-flow/web/* /app \ && rm -rf /deer-flow -# Install dependencies based on the preferred package manager -RUN if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ +# 配置 npm 淘宝镜像并安装依赖 +RUN npm config set registry https://registry.npmmirror.com && \ + if [ -f yarn.lock ]; then yarn config set registry https://registry.npmmirror.com && yarn --frozen-lockfile; \ elif [ -f package-lock.json ]; then npm ci; \ - elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm i; \ + elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm config set registry https://registry.npmmirror.com && pnpm i; \ else echo "Lockfile not found." && exit 1; \ fi @@ -34,9 +35,11 @@ COPY --from=deps /app/node_modules ./node_modules ENV NEXT_TELEMETRY_DISABLED=1 -RUN if [ -f yarn.lock ]; then SKIP_ENV_VALIDATION=1 yarn build; \ +# 配置 npm 淘宝镜像 +RUN npm config set registry https://registry.npmmirror.com && \ + if [ -f yarn.lock ]; then yarn config set registry https://registry.npmmirror.com && SKIP_ENV_VALIDATION=1 yarn build; \ elif [ -f package-lock.json ]; then SKIP_ENV_VALIDATION=1 npm run build; \ - elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && SKIP_ENV_VALIDATION=1 pnpm run build; \ + elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm config set registry https://registry.npmmirror.com && SKIP_ENV_VALIDATION=1 pnpm run build; \ else echo "Lockfile not found." && exit 1; \ fi diff --git a/scripts/images/gateway/Dockerfile b/scripts/images/gateway/Dockerfile index 06e6428..e4a990a 100644 --- a/scripts/images/gateway/Dockerfile +++ b/scripts/images/gateway/Dockerfile @@ -1,5 +1,21 @@ FROM maven:3-eclipse-temurin-21 AS builder +# 配置 Maven 阿里云镜像 +RUN mkdir -p /root/.m2 && \ + echo '\n\ +\n\ + \n\ + \n\ + aliyunmaven\n\ + *\n\ + 阿里云公共仓库\n\ + https://maven.aliyun.com/repository/public\n\ + \n\ + \n\ +' > /root/.m2/settings.xml + COPY backend/ /opt/gateway RUN cd /opt/gateway/api-gateway && \ @@ -8,7 +24,13 @@ RUN cd /opt/gateway/api-gateway && \ FROM eclipse-temurin:21-jdk -RUN apt-get update && \ +# 配置 apt 阿里云镜像源 +RUN if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + elif [ -f /etc/apt/sources.list ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g; s/archive.ubuntu.com/mirrors.aliyun.com/g; s/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list; \ + fi && \ + apt-get update && \ apt-get install -y vim wget curl dos2unix && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* diff --git a/scripts/images/label-studio/Dockerfile b/scripts/images/label-studio/Dockerfile index 767a60e..ab20f07 100644 --- a/scripts/images/label-studio/Dockerfile +++ b/scripts/images/label-studio/Dockerfile @@ -96,7 +96,11 @@ RUN python /tmp/install-poetry.py RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ set -eux; \ - sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + elif [ -f /etc/apt/sources.list ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list; \ + fi; \ apt-get update; \ apt-get install --no-install-recommends -y \ build-essential git; \ @@ -157,7 +161,11 @@ WORKDIR $LS_DIR RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ set -eux; \ - sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources; \ + elif [ -f /etc/apt/sources.list ]; then \ + sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list; \ + fi; \ apt-get update; \ apt-get upgrade -y; \ apt-get install --no-install-recommends -y libexpat1 libgl1 libglx-mesa0 libglib2.0-0t64 \