feat: 增加mirror,提高编译速度
Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled

This commit is contained in:
chuan
2025-11-07 00:35:08 +08:00
parent 0ce5de85df
commit 266ee74fc1
15 changed files with 147 additions and 2 deletions

3
.npmrc
View File

@@ -32,3 +32,6 @@ prefer-offline=true
# Ensure workspace protocol is used when adding internal deps # Ensure workspace protocol is used when adding internal deps
save-workspace-protocol=true save-workspace-protocol=true
# Configure Chinese mirrors for faster downloads in China
registry=https://registry.npmmirror.com

View File

@@ -1,5 +1,12 @@
FROM node:22-alpine AS base FROM node:22-alpine AS base
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
WORKDIR /app WORKDIR /app
ENV TURBO_TELEMETRY_DISABLED=1 ENV TURBO_TELEMETRY_DISABLED=1

View File

@@ -1,4 +1,12 @@
FROM node:22-alpine FROM node:22-alpine
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app

View File

@@ -6,6 +6,13 @@ ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV INSTANCE_CHANGELOG_URL=https://sites.plane.so/pages/691ef037bcfe416a902e48cb55f59891/ ENV INSTANCE_CHANGELOG_URL=https://sites.plane.so/pages/691ef037bcfe416a902e48cb55f59891/
# Configure Chinese mirrors for pip
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# Update system packages for security # Update system packages for security
RUN apk update && apk upgrade RUN apk update && apk upgrade
@@ -19,6 +26,7 @@ RUN apk add --no-cache --upgrade \
"openssl" "openssl"
COPY requirements.txt ./ COPY requirements.txt ./
COPY pip.conf /etc/pip.conf
COPY requirements ./requirements COPY requirements ./requirements
RUN apk add --no-cache libffi-dev RUN apk add --no-cache libffi-dev
RUN apk add --no-cache --virtual .build-deps \ RUN apk add --no-cache --virtual .build-deps \

View File

@@ -6,6 +6,13 @@ ENV PYTHONUNBUFFERED 1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV INSTANCE_CHANGELOG_URL https://sites.plane.so/pages/691ef037bcfe416a902e48cb55f59891/ ENV INSTANCE_CHANGELOG_URL https://sites.plane.so/pages/691ef037bcfe416a902e48cb55f59891/
# Configure Chinese mirrors for pip
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk --no-cache add \ RUN apk --no-cache add \
"bash~=5.2" \ "bash~=5.2" \
"libpq" \ "libpq" \
@@ -26,6 +33,7 @@ RUN apk --no-cache add \
WORKDIR /code WORKDIR /code
COPY requirements.txt ./requirements.txt COPY requirements.txt ./requirements.txt
COPY pip.conf /etc/pip.conf
ADD requirements ./requirements ADD requirements ./requirements
# Install the local development settings # Install the local development settings

6
apps/api/pip.conf Normal file
View File

@@ -0,0 +1,6 @@
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

View File

@@ -1,5 +1,12 @@
FROM node:22-alpine FROM node:22-alpine
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app

View File

@@ -1,6 +1,13 @@
# syntax=docker/dockerfile:1.7 # syntax=docker/dockerfile:1.7
FROM node:22-alpine AS base FROM node:22-alpine AS base
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# Setup pnpm package manager with corepack and configure global bin directory for caching # Setup pnpm package manager with corepack and configure global bin directory for caching
ENV PNPM_HOME="/pnpm" ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH" ENV PATH="$PNPM_HOME:$PATH"

View File

@@ -1,5 +1,8 @@
FROM caddy:2.10.0-builder-alpine AS caddy-builder FROM caddy:2.10.0-builder-alpine AS caddy-builder
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN xcaddy build \ RUN xcaddy build \
--with github.com/caddy-dns/cloudflare@v0.2.1 \ --with github.com/caddy-dns/cloudflare@v0.2.1 \
--with github.com/caddy-dns/digitalocean@04bde2867106aa1b44c2f9da41a285fa02e629c5 \ --with github.com/caddy-dns/digitalocean@04bde2867106aa1b44c2f9da41a285fa02e629c5 \

View File

@@ -1,5 +1,12 @@
FROM node:22-alpine FROM node:22-alpine
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
# Set working directory # Set working directory

View File

@@ -1,5 +1,12 @@
FROM node:22-alpine AS base FROM node:22-alpine AS base
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
WORKDIR /app WORKDIR /app
ENV TURBO_TELEMETRY_DISABLED=1 ENV TURBO_TELEMETRY_DISABLED=1

View File

@@ -1,5 +1,12 @@
FROM node:22-alpine FROM node:22-alpine
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app

View File

@@ -1,6 +1,13 @@
# syntax=docker/dockerfile:1.7 # syntax=docker/dockerfile:1.7
FROM node:22-alpine AS base FROM node:22-alpine AS base
# Configure Chinese mirrors for npm/pnpm
ENV npm_config_registry=https://registry.npmmirror.com
ENV PNPM_REGISTRY=https://registry.npmmirror.com
# Configure Chinese mirrors for apk
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# Setup pnpm package manager with corepack and configure global bin directory for caching # Setup pnpm package manager with corepack and configure global bin directory for caching
ENV PNPM_HOME="/pnpm" ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH" ENV PATH="$PNPM_HOME:$PATH"

View File

@@ -0,0 +1,56 @@
# WSL2 Docker 凭证错误修复
## 错误现象
```bash
docker compose -f docker-compose-local.yml up -d
```
构建失败,报错:
```
error getting credentials - err: fork/exec /usr/bin/docker-credential-desktop.exe: exec format error
```
## 根本原因
Docker Desktop 在 Windows 上安装后,会在 `~/.docker/config.json` 中配置 Windows 凭证助手:
```json
{
"credsStore": "desktop.exe"
}
```
WSL2 是 Linux 环境,无法执行 `.exe` 文件,导致 Docker 在拉取镜像时尝试调用凭证助手失败。
## 解决方案
编辑 `~/.docker/config.json`,禁用凭证存储:
```json
{
"auths": {},
"credsStore": ""
}
```
或直接执行:
```bash
mkdir -p ~/.docker
cat > ~/.docker/config.json << 'EOF'
{
"auths": {},
"credsStore": ""
}
EOF
```
## 验证
重新运行 Docker Compose镜像拉取和构建正常进行
```bash
docker compose -f docker-compose-local.yml up -d
```

View File

@@ -77,6 +77,10 @@ else
success=false success=false
fi fi
# Configure Chinese mirrors for npm/pnpm before installation
export npm_config_registry=https://registry.npmmirror.com
export PNPM_REGISTRY=https://registry.npmmirror.com
# Activate pnpm (version set in package.json) # Activate pnpm (version set in package.json)
corepack enable pnpm || success=false corepack enable pnpm || success=false
# Install Node dependencies # Install Node dependencies