mirror of
https://github.com/chatfire-AI/huobao-drama.git
synced 2026-01-24 12:33:23 +08:00
feat:增加docker compose部署配置国内镜像源说明
This commit is contained in:
@@ -26,6 +26,7 @@ backend
|
||||
|
||||
# 依赖
|
||||
node_modules/
|
||||
**/node_modules/
|
||||
vendor/
|
||||
|
||||
# 数据文件
|
||||
|
||||
48
README-CN.md
48
README-CN.md
@@ -239,6 +239,54 @@ go run main.go
|
||||
|
||||
#### 方式一:Docker Compose(推荐)
|
||||
|
||||
#### 🚀 国内网络加速(可选)
|
||||
|
||||
如果您在国内网络环境下,Docker 拉取镜像和安装依赖可能较慢。可以通过配置镜像源加速构建过程。
|
||||
|
||||
**步骤 1:创建环境变量文件**
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
**步骤 2:编辑 `.env` 文件,取消注释需要的镜像源**
|
||||
|
||||
```bash
|
||||
# 启用 Docker Hub 镜像(推荐)
|
||||
DOCKER_REGISTRY=docker.1ms.run/
|
||||
|
||||
# 启用 npm 镜像
|
||||
NPM_REGISTRY=https://registry.npmmirror.com/
|
||||
|
||||
# 启用 Go 代理
|
||||
GO_PROXY=https://goproxy.cn,direct
|
||||
|
||||
# 启用 Alpine 镜像
|
||||
ALPINE_MIRROR=mirrors.aliyun.com
|
||||
```
|
||||
|
||||
**步骤 3:使用 docker compose 构建(必须)**
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
```
|
||||
|
||||
> **重要说明**:
|
||||
>
|
||||
> - ⚠️ 必须使用 `docker compose build` 才能自动加载 `.env` 文件中的镜像源配置
|
||||
> - ❌ 如果使用 `docker build` 命令,需要手动传递 `--build-arg` 参数
|
||||
> - ✅ 推荐始终使用 `docker compose build` 进行构建
|
||||
|
||||
**效果对比**:
|
||||
|
||||
| 操作 | 不配置镜像源 | 配置镜像源后 |
|
||||
| ------------- | ------------ | ------------ |
|
||||
| 拉取基础镜像 | 5-30 分钟 | 1-5 分钟 |
|
||||
| 安装 npm 依赖 | 可能失败 | 快速成功 |
|
||||
| 下载 Go 依赖 | 5-10 分钟 | 30 秒-1 分钟 |
|
||||
|
||||
> **注意**:国外用户请勿配置镜像源,使用默认配置即可。
|
||||
|
||||
```bash
|
||||
# 启动服务
|
||||
docker-compose up -d
|
||||
|
||||
48
README-JA.md
48
README-JA.md
@@ -239,6 +239,54 @@ go run main.go
|
||||
|
||||
#### 方法 1: Docker Compose(推奨)
|
||||
|
||||
#### 🚀 中国国内ネットワーク高速化(オプション)
|
||||
|
||||
中国国内のネットワーク環境では、Docker イメージのプルや依存関係のインストールが遅い場合があります。ミラーソースを設定することでビルドプロセスを高速化できます。
|
||||
|
||||
**ステップ 1: 環境変数ファイルを作成**
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
**ステップ 2: `.env` ファイルを編集し、必要なミラーソースのコメントを解除**
|
||||
|
||||
```bash
|
||||
# Docker Hub ミラーを有効化(推奨)
|
||||
DOCKER_REGISTRY=docker.1ms.run/
|
||||
|
||||
# npm ミラーを有効化
|
||||
NPM_REGISTRY=https://registry.npmmirror.com/
|
||||
|
||||
# Go プロキシを有効化
|
||||
GO_PROXY=https://goproxy.cn,direct
|
||||
|
||||
# Alpine ミラーを有効化
|
||||
ALPINE_MIRROR=mirrors.aliyun.com
|
||||
```
|
||||
|
||||
**ステップ 3: docker compose でビルド(必須)**
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
```
|
||||
|
||||
> **重要な注意事項**:
|
||||
>
|
||||
> - ⚠️ `.env` ファイルのミラーソース設定を自動的に読み込むには `docker compose build` を使用する必要があります
|
||||
> - ❌ `docker build` コマンドを使用する場合は、手動で `--build-arg` パラメータを渡す必要があります
|
||||
> - ✅ 常に `docker compose build` を使用してビルドすることを推奨
|
||||
|
||||
**パフォーマンス比較**:
|
||||
|
||||
| 操作 | ミラー未設定 | ミラー設定後 |
|
||||
| ------------------------ | -------------- | ------------ |
|
||||
| ベースイメージのプル | 5-30 分 | 1-5 分 |
|
||||
| npm 依存関係インストール | 失敗する可能性 | 高速成功 |
|
||||
| Go 依存関係ダウンロード | 5-10 分 | 30 秒-1 分 |
|
||||
|
||||
> **注意**: 中国国外のユーザーはミラーソースを設定せず、デフォルト設定を使用してください。
|
||||
|
||||
```bash
|
||||
# サービスを起動
|
||||
docker-compose up -d
|
||||
|
||||
48
README.md
48
README.md
@@ -178,6 +178,54 @@ ai:
|
||||
|
||||
### 📥 Installation
|
||||
|
||||
#### 🚀 China Network Acceleration (Optional)
|
||||
|
||||
If you are in China, pulling Docker images and installing dependencies may be slow. You can speed up the build process by configuring mirror sources.
|
||||
|
||||
**Step 1: Create environment variable file**
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
**Step 2: Edit `.env` file and uncomment the mirror sources you need**
|
||||
|
||||
```bash
|
||||
# Enable Docker Hub mirror (recommended)
|
||||
DOCKER_REGISTRY=docker.1ms.run/
|
||||
|
||||
# Enable npm mirror
|
||||
NPM_REGISTRY=https://registry.npmmirror.com/
|
||||
|
||||
# Enable Go proxy
|
||||
GO_PROXY=https://goproxy.cn,direct
|
||||
|
||||
# Enable Alpine mirror
|
||||
ALPINE_MIRROR=mirrors.aliyun.com
|
||||
```
|
||||
|
||||
**Step 3: Build with docker compose (required)**
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
```
|
||||
|
||||
> **Important Note**:
|
||||
>
|
||||
> - ⚠️ You must use `docker compose build` to automatically load mirror source configurations from the `.env` file
|
||||
> - ❌ If using `docker build` command, you need to manually pass `--build-arg` parameters
|
||||
> - ✅ Always recommended to use `docker compose build` for building
|
||||
|
||||
**Performance Comparison**:
|
||||
|
||||
| Operation | Without Mirrors | With Mirrors |
|
||||
| ---------------- | --------------- | ------------ |
|
||||
| Pull base images | 5-30 minutes | 1-5 minutes |
|
||||
| Install npm deps | May fail | Fast success |
|
||||
| Download Go deps | 5-10 minutes | 30s-1 minute |
|
||||
|
||||
> **Note**: Users outside China should not configure mirror sources, use default settings.
|
||||
|
||||
```bash
|
||||
# Clone the project
|
||||
git clone https://github.com/chatfire-AI/huobao-drama.git
|
||||
|
||||
Reference in New Issue
Block a user