diff --git a/subweb/.env b/subweb/.env deleted file mode 100644 index be08eae..0000000 --- a/subweb/.env +++ /dev/null @@ -1,2 +0,0 @@ -NODE_ENV = 'development' -VUE_APP_BASE_API_URL = 'http://127.0.0.1:25500' \ No newline at end of file diff --git a/subweb/.env.production b/subweb/.env.production deleted file mode 100644 index 87a250a..0000000 --- a/subweb/.env.production +++ /dev/null @@ -1,2 +0,0 @@ -NODE_ENV = 'production' -VUE_APP_BASE_API_URL = 'http://127.0.0.1:25500' \ No newline at end of file diff --git a/subweb/Dockerfile b/subweb/Dockerfile index bbb2765..aea065f 100644 --- a/subweb/Dockerfile +++ b/subweb/Dockerfile @@ -8,5 +8,6 @@ RUN npm run build FROM nginx:1.16-alpine COPY --from=build /app/dist /usr/share/nginx/html +COPY . /app EXPOSE 80 -CMD [ "nginx", "-g", "daemon off;" ] +CMD [ "sh", "-c", "/app/start.sh" ] diff --git a/subweb/README.md b/subweb/README.md index 4a4092c..9133cc6 100644 --- a/subweb/README.md +++ b/subweb/README.md @@ -1,8 +1,4 @@ # subweb -GitHub [stilleshan/dockerfiles](https://github.com/stilleshan/dockerfiles) -Docker [stilleshan/subweb](https://hub.docker.com/r/stilleshan/subweb) -> *docker image support for X86 and ARM* - ## 简介 subweb 是基于 subconverter 订阅转换的前端项目,方便用户快速生成各平台的订阅链接. @@ -10,6 +6,7 @@ subweb 是基于 subconverter 订阅转换的前端项目,方便用户快速生 *GitHub [stilleshan/subweb](https://github.com/stilleshan/subweb) Docker [stilleshan/subweb](https://hub.docker.com/r/stilleshan/subweb)* +> *docker image support for X86 and ARM* ## 示例 [https://sub.ops.ci](https://sub.ops.ci) @@ -17,27 +14,39 @@ Docker [stilleshan/subweb](https://hub.docker.com/r/stilleshan/subweb)* ## 部署 ### docker 本地版 -*适用于本机部署使用* +*适用于本机快速部署使用* ```shell -docker run -d --name subweb --restart always -p 18080:80 stilleshan/subweb +docker run -d --name subweb --restart always \ + -p 18080:80 \ + stilleshan/subweb ``` 访问 `http://127.0.0.1:18080` -### docker 在线版 (自定义后端 API) -*适用于服务器部署,配合域名反代使用* +### docker 自定义版 +自定义版可以挂载配置文件来修改`API 地址`,`站点名称`,`导航链接`. +参考以下命令,修改本地挂载路径,启动容器后会生成`config.js`配置文件,更改后刷新生效. -**修改自定义 subconverter API 地址需要自行编译构建镜像. ** ```shell -git clone https://github.com/stilleshan/subweb -cd subweb -# 修改 .env.productionn 中 VUE_APP_BASE_API_URL 为你 subconverter 后端 API 地址. -docker build -t subweb . -# 构建镜像 -docker run -d --name subweb --restart always -p 18080:80 subweb -# 启动容器 +docker run -d --name subweb --restart always \ + -p 18080:80 \ + -v /PATH/subweb/conf:/usr/share/nginx/html/conf \ + stilleshan/subweb ``` +同时也可以不挂载目录,直接通过`-e`环境变量来修改`API 地址`和`站点名称`,但是无法修改`导航链接`. +```shell +docker run -d --name subweb --restart always \ + -p 18080:80 \ + -e SITE_NAME=subweb \ + -e API_URL=https://sub.ops.ci \ + stilleshan/subweb +``` + +访问 `http://127.0.0.1:18080` +> *推荐使用 nginx 反向代理部署* + + ## 链接 - [GitHub - stilleshan/subweb](https://github.com/stilleshan/subweb) - [GitHub - stilleshan/subconverter](https://github.com/stilleshan/subconverter) diff --git a/subweb/public/conf/config.js b/subweb/public/conf/config.js new file mode 100644 index 0000000..5460480 --- /dev/null +++ b/subweb/public/conf/config.js @@ -0,0 +1,16 @@ +window.config = { + siteName: 'Subconverter Web', + apiUrl: 'http://127.0.0.1:25500', + menuItem: [ + { + title: '首页', + link: '/', + target: '', + }, + { + title: 'GitHub', + link: 'https://github.com/stilleshan/subweb', + target: '_blank', + }, + ], +}; diff --git a/subweb/public/index.html b/subweb/public/index.html index 3e5a139..0aaa0f1 100644 --- a/subweb/public/index.html +++ b/subweb/public/index.html @@ -6,6 +6,7 @@ <%= htmlWebpackPlugin.options.title %> +