perf(identity-service): 添加 Docker 构建镜像加速
- Alpine: 使用 mirrors.aliyun.com - Debian: 使用 mirrors.aliyun.com - npm: 使用 registry.npmmirror.com (淘宝镜像) 加速中国区 Docker 构建速度 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ef21009644
commit
eba8953e3a
|
|
@ -5,6 +5,12 @@
|
|||
# Build stage - use Alpine for smaller build context
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
# Use Aliyun mirror for Alpine packages (China acceleration)
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
|
||||
# Use taobao npm registry (China acceleration)
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
|
|
@ -35,12 +41,19 @@ FROM node:20-slim
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Use Aliyun mirror for Debian packages (China acceleration)
|
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
||||
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list 2>/dev/null || true
|
||||
|
||||
# Install OpenSSL and curl for health checks
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssl \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Use taobao npm registry (China acceleration)
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package*.json ./
|
||||
RUN npm ci --only=production
|
||||
|
|
|
|||
Loading…
Reference in New Issue