Update Dockerfile to use domestic mirrors for package installation and npm registry

This commit is contained in:
theluyuan 2025-10-30 23:17:14 +08:00
parent 480f224ab6
commit 4b3cb9cc13
2 changed files with 12 additions and 1 deletions

View File

@ -2,6 +2,11 @@
## 🐳 Docker 快速开始
> 📌 **国内用户注意**Dockerfile已配置国内镜像源加速包括
> - Alpine Linux包管理器使用阿里云镜像源
> - npm使用淘宝镜像源
> - 大幅提升构建速度!
### 方式一:使用 Docker Compose推荐
1. **克隆项目**

View File

@ -8,7 +8,10 @@ WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
# 安装系统依赖(用于数据库编译)
# 配置国内镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装系统依赖(使用国内镜像源)
RUN apk add --no-cache \
sqlite \
sqlite-dev \
@ -16,6 +19,9 @@ RUN apk add --no-cache \
make \
g++
# 配置npm使用国内镜像源
RUN npm config set registry https://registry.npmmirror.com
# 复制package.json和package-lock.json如果存在
COPY package*.json ./