Skip to content

Commit

Permalink
opt: 优化 docker-compse 构建脚本,修复后端路由 Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yangjian102621 committed Jun 23, 2023
1 parent 1795a89 commit d03ed65
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ make linux
个人的力量始终有限,任何形式的贡献都是欢迎的,包括但不限于贡献代码,优化文档,提交 issue 和 PR 等。
**尤其是新版本的开发计划比较大,包括各种语言的后端 API 实现,本人精力有限,希望借助社区的力量来完成这些 API 的开发。**

如果有兴趣的话,也可以加微信进入微信讨论群。
如果有兴趣的话,也可以加微信进入微信讨论群**添加好友时请注明来自Github!!!**

![微信名片](docs/imgs/wx.png)

Expand Down
4 changes: 2 additions & 2 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ npm run build
cd ../docker

# remove docker image if exists
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:$version
docker rmi chatgpt-plus-go:$version
# build docker image for chatgpt-plus-go
docker build -t chatgpt-plus-go:$version -f dockerfile-api-go ../

# build docker image for chatgpt-plus-vue
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:$version
docker rmi chatgpt-plus-vue:$version
docker build -t chatgpt-plus-vue:$version -f dockerfile-vue ../

# add tag for aliyum docker registry
goImageId=`docker images |grep chatgpt-plus-go |grep $version |awk '{print $3}'`
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:$version
docker tag $goImageId registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:$version

vueImageId=`docker images |grep chatgpt-plus-vue |grep $version |awk '{print $3}'`
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:$version
docker tag $vueImageId registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:$version

2 changes: 1 addition & 1 deletion docker/conf/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Listen = "0.0.0.0:5678"
ProxyURL = "http://127.0.0.1:7777"
ProxyURL = "http://192.168.3.200:7777"
MysqlDns = "root:12345678@tcp(192.168.3.200:3306)/chatgpt_plus?charset=utf8mb4&parseTime=True&loc=Local"

[Session]
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/nginx/conf.d/chatgpt-plus.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://192.168.3.200:5678; # 这里改成后端服务的内网 IP 地址
proxy_pass http://192.168.3.200:6789; # 这里改成后端服务的内网 IP 地址
}
}

Expand Down
13 changes: 6 additions & 7 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ version: '3'
services:
# 后端 API 程序
chatgpt-plus-go:
image: registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:v3.0.0
# image: chatplus-go:v3.0.0
image: registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:v3.0.1
# image: chatgpt-plus-go:v3.0.1
container_name: chatgpt-plus-go
#build: ./
restart: always
# network_mode: host
# network_mode: host
ports:
- "5678:5678"
- "6789:5678"
volumes:
- ./conf/config.toml:/var/www/app/config.toml

# 前端应用
chatgpt-vue:
image: registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:v3.0.0
# image: chatplus-vue:v3.0.0
image: registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:v3.0.1
# image: chatgpt-plus-vue:v3.0.1
container_name: chatgpt-plus-vue
#build: ./
restart: always
Expand Down
3 changes: 3 additions & 0 deletions docker/dockerfile-api-go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ COPY ./api/go/bin/chatgpt-v3-amd64-linux /var/www/app

EXPOSE 5678

RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends ca-certificates curl

# 容器启动时执行的命令
CMD ["./chatgpt-v3-amd64-linux"]
4 changes: 3 additions & 1 deletion docker/dockerfile-vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ MAINTAINER yangjian<yangjian102621@163.com>
WORKDIR /var/www/app
COPY ./web/dist /var/www/app/dist

EXPOSE 80 443 8080
EXPOSE 80
EXPOSE 443
EXPOSE 8080
12 changes: 6 additions & 6 deletions web/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ const routes = [
{name: 'login', path: '/login', component: Login, meta: {title: '用户登录'}},
{name: 'register', path: '/register', component: Register, meta: {title: '用户注册'}},
{name: 'plus', path: '/chat', component: ChatPlus, meta: {title: 'ChatGPT-智能助手V3'}},
{
path: '/admin/login',
name: 'admin-login',
meta: {title: 'Chat-Plus 控制台登录'},
component: () => import('@/views/admin/Login.vue'),
},
{
name: 'admin',
path: '/admin',
redirect: '/admin/welcome',
component: () => import("@/views/admin/Home.vue"),
meta: {title: 'ChatGPT-Plus 管理后台'},
children: [
{
path: '/admin/welcome',
name: 'admin-home',
meta: {title: 'Chat-Plus 控制台登录'},
component: () => import('@/views/admin/Login.vue'),
},
{
path: '/admin/welcome',
name: 'admin-home',
Expand Down

0 comments on commit d03ed65

Please sign in to comment.