feat: 添加Docker国内镜像源配置支持

- 使用Build Args方式保持Dockerfile通用性
- 支持Docker Hub、npm、Go代理、Alpine apk镜像源配置
- 添加.env.example配置示例文件
- 更新README添加镜像源使用说明

配置方式:
1. 复制 .env.example 为 .env
2. 取消注释需要的镜像源配置
3. 运行 docker compose build

支持的镜像源:
- DOCKER_REGISTRY: Docker Hub 镜像前缀
- NPM_REGISTRY: npm 包镜像源
- GO_PROXY: Go 模块代理
- ALPINE_MIRROR: Alpine apk 镜像源
This commit is contained in:
ShellMonster
2026-01-20 11:06:30 +08:00
parent db7103aa51
commit 3d6dda8a17
4 changed files with 164 additions and 8 deletions

67
.env.example Normal file
View File

@@ -0,0 +1,67 @@
# ========================================
# Docker 镜像源配置示例
# ========================================
#
# 【使用方法】
# 1. 复制此文件cp .env.example .env
# 2. 编辑 .env 文件,删掉下面 4 个配置行前面的 # 号:
# - DOCKER_REGISTRY
# - NPM_REGISTRY
# - GO_PROXY
# - ALPINE_MIRROR
# 3. 保存后运行docker-compose build
#
# 【注意】
# - 只删除配置行前面的 #,不要删除注释说明的 #
# - 国外用户请勿配置,使用默认官方源即可
#
# ========================================
# -----------------------------
# Docker Hub 镜像源(末尾必须有斜杠 /
# -----------------------------
#
# 推荐镜像源:
# docker.1ms.run/ - 速度快,推荐
# dockerpull.org/ - 备用
# dockerproxy.cn/ - 备用
#
# 删除下面行首的 # 来启用:
# DOCKER_REGISTRY=docker.1ms.run/
# -----------------------------
# npm 镜像源(末尾斜杠可选)
# -----------------------------
#
# 推荐镜像源:
# https://registry.npmmirror.com/ - 淘宝镜像,推荐
#
# 删除下面行首的 # 来启用:
# NPM_REGISTRY=https://registry.npmmirror.com/
# -----------------------------
# Go 模块代理(注意末尾不要斜杠)
# -----------------------------
#
# 推荐镜像源:
# https://goproxy.cn,direct - 七牛云,推荐
# https://goproxy.io,direct - 备用
# https://mirrors.aliyun.com/goproxy/,direct - 阿里云
#
# 删除下面行首的 # 来启用:
# GO_PROXY=https://goproxy.cn,direct
# -----------------------------
# Alpine apk 镜像源(末尾不要斜杠)
# -----------------------------
#
# 推荐镜像源:
# mirrors.aliyun.com - 阿里云,推荐
# mirrors.tuna.tsinghua.edu.cn - 清华大学
# mirrors.ustc.edu.cn - 中科大
#
# 删除下面行首的 # 来启用:
# ALPINE_MIRROR=mirrors.aliyun.com