Update README

This commit is contained in:
hkfires
2025-09-07 11:58:43 +08:00
parent 5aba4ca1b1
commit 2a2a276e3b
2 changed files with 52 additions and 28 deletions

View File

@@ -497,26 +497,38 @@ docker run --rm -p 8317:8317 -v /path/to/your/config.yaml:/CLIProxyAPI/config.ya
## Run with Docker Compose ## Run with Docker Compose
1. Clone the repository: 1. Clone the repository and navigate into the directory:
```bash ```bash
git clone https://github.com/luispater/CLIProxyAPI.git git clone https://github.com/luispater/CLIProxyAPI.git
cd CLIProxyAPI cd CLIProxyAPI
``` ```
2. Create a `config.yaml` from `config.example.yaml` and customize it. 2. Prepare the configuration file:
Create a `config.yaml` file by copying the example and customize it to your needs.
```bash
cp config.example.yaml config.yaml
```
*(Note for Windows users: You can use `copy config.example.yaml config.yaml` in CMD or PowerShell.)*
3. Run the interactive script to start the service: 3. Start the service:
- For Windows (PowerShell): - **For most users (recommended):**
```powershell Run the following command to start the service using the pre-built image from Docker Hub. The service will run in the background.
.\docker-build.ps1 ```bash
``` docker compose up -d
- For Linux/macOS: ```
```bash - **For advanced users:**
bash docker-build.sh If you have modified the source code and need to build a new image, use the interactive helper scripts:
``` - For Windows (PowerShell):
The script will prompt you to choose how to run the application: ```powershell
- **Option 1: Run using Pre-built Image (Recommended)**: Pulls the latest official image from the registry and starts the container. This is the easiest way to get started. .\docker-build.ps1
- **Option 2: Build from Source and Run (For Developers)**: Builds the image from the local source code, tags it as `cli-proxy-api:local`, and then starts the container. This is useful if you are making changes to the source code. ```
- For Linux/macOS:
```bash
bash docker-build.sh
```
The script will prompt you to choose how to run the application:
- **Option 1: Run using Pre-built Image (Recommended)**: Pulls the latest official image from the registry and starts the container. This is the easiest way to get started.
- **Option 2: Build from Source and Run (For Developers)**: Builds the image from the local source code, tags it as `cli-proxy-api:local`, and then starts the container. This is useful if you are making changes to the source code.
4. To authenticate with providers, run the login command inside the container: 4. To authenticate with providers, run the login command inside the container:
- **Gemini**: `docker compose exec cli-proxy-api /CLIProxyAPI/CLIProxyAPI -no-browser --login` - **Gemini**: `docker compose exec cli-proxy-api /CLIProxyAPI/CLIProxyAPI -no-browser --login`

View File

@@ -512,26 +512,38 @@ docker run --rm -p 8317:8317 -v /path/to/your/config.yaml:/CLIProxyAPI/config.ya
## 使用 Docker Compose 运行 ## 使用 Docker Compose 运行
1. 克隆仓库: 1. 克隆仓库并进入目录:
```bash ```bash
git clone https://github.com/luispater/CLIProxyAPI.git git clone https://github.com/luispater/CLIProxyAPI.git
cd CLIProxyAPI cd CLIProxyAPI
``` ```
2. 从 `config.example.yaml` 创建一个 `config.yaml` 文件并进行自定义。 2. 准备配置文件:
通过复制示例文件来创建 `config.yaml` 文件,并根据您的需求进行自定义。
```bash
cp config.example.yaml config.yaml
```
*Windows 用户请注意:您可以在 CMD 或 PowerShell 中使用 `copy config.example.yaml config.yaml`。)*
3. 运行交互式脚本以启动服务: 3. 启动服务:
- Windows (PowerShell): - **适用于大多数用户(推荐):**
```powershell 运行以下命令,使用 Docker Hub 上的预构建镜像启动服务。服务将在后台运行。
.\docker-build.ps1 ```bash
``` docker compose up -d
- Linux/macOS: ```
```bash - **适用于进阶用户:**
bash docker-build.sh 如果您修改了源代码并需要构建新镜像,请使用交互式辅助脚本:
``` - 对于 Windows (PowerShell):
脚本将提示您选择运行方式: ```powershell
- **选项 1使用预构建的镜像运行 (推荐)**:从镜像仓库拉取最新的官方镜像并启动容器。这是最简单的开始方式。 .\docker-build.ps1
- **选项 2从源码构建并运行 (适用于开发者)**:从本地源代码构建镜像,将其标记为 `cli-proxy-api:local`,然后启动容器。如果您需要修改源代码,此选项很有用。 ```
- 对于 Linux/macOS:
```bash
bash docker-build.sh
```
脚本将提示您选择运行方式:
- **选项 1使用预构建的镜像运行 (推荐)**:从镜像仓库拉取最新的官方镜像并启动容器。这是最简单的开始方式。
- **选项 2从源码构建并运行 (适用于开发者)**:从本地源代码构建镜像,将其标记为 `cli-proxy-api:local`,然后启动容器。如果您需要修改源代码,此选项很有用。
4. 要在容器内运行登录命令进行身份验证: 4. 要在容器内运行登录命令进行身份验证:
- **Gemini**: `docker compose exec cli-proxy-api /CLIProxyAPI/CLIProxyAPI -no-browser --login` - **Gemini**: `docker compose exec cli-proxy-api /CLIProxyAPI/CLIProxyAPI -no-browser --login`