From 4c7d08c56009a0fbfb437c9aa630da2ad85480c3 Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Sun, 31 Dec 2023 21:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0docker-compose=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 +++++++++++++++++++++++++------ docker-compose.yml | 14 ++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 4684ac4..9682762 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Sun-Proxy -一个简单的反向代理程序, 为 [sun-panel](https://github.com/hslr-s/sun-panel)插件打造 +一个简单的反向代理程序, 为 [sun-panel](https://github.com/hslr-s/sun-panel) 插件打造 -### TODO +DockerHub地址:https://hub.docker.com/r/hslr/sun-proxy + +## TODO - [x] 自动填入目标站的basic信息 - [x] 给代理站增加basic验证 @@ -14,7 +16,7 @@ - [ ] 网址内容替换 -### 目前已经实现4种模式: +## 目前已经实现4种模式: 域名 => 域名 calendar.cn:8080 => http://192.168.3.100 @@ -29,7 +31,7 @@ calendar.cn:8080 => http://192.168.3.100 127.0.0.1:8080/sun-panel-tool-page => http://localhost:1003/sun-panel-tool-page -### 命令说明 +## 命令说明 ``` -c string @@ -38,9 +40,15 @@ calendar.cn:8080 => http://192.168.3.100 generate sample configuration file 生成示例配置文件 ``` +执行示例: + +```sh +./sun-proxy -c ./sun-proxy.yml +``` -### 配置文件示例 +## 配置文件 +一个完整的示例 `./sun-proxy.yml` ```yml name: Sun-Proxy port: @@ -67,7 +75,7 @@ rules: 123456 ``` -### docker +## docker 运行 |参数|示例|说明| |---|---|---| @@ -92,4 +100,15 @@ hslr/sun-proxy 构建: ``` docker build -t hslr/sun-proxy . +``` + +## docker compose运行 +查看[docker-compose.yml](docker-compose.yml) + +```sh +# start +./docker-compose up -d + +# close +./docker-compose down ``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d8d9616 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.2" + +services: + sun-proxy: + image: 'hslr/sun-proxy:latest' + container_name: sun-proxy + volumes: + - ./sun-proxy.yml:/app/sun-proxy.yml + - ./cert:/app/cert + ports: + - 8080:8080 # http + - 8081:8081 # https + restart: always + command: ['./sun-proxy', '-c', './sun-proxy.yml'] \ No newline at end of file