mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 01:36:38 +08:00
docker
This commit is contained in:
parent
654057e7a7
commit
a9ecaed5bd
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# FROM 表示设置要制作的镜像基于哪个镜像,FROM指令必须是整个Dockerfile的第一个指令,如果指定的镜像不存在默认会自动从Docker Hub上下载。
|
||||||
|
FROM centos:7
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY src/bin/wechatGPT-amd64-linux /usr/src/app
|
||||||
|
|
||||||
|
# 容器对外暴露的端口号,这里和配置文件保持一致就可以
|
||||||
|
EXPOSE 5678
|
||||||
|
|
||||||
|
# 容器启动时执行的命令
|
||||||
|
CMD ["./wechatGPT-amd64-linux"]
|
11
README.md
11
README.md
@ -188,6 +188,9 @@ make linux
|
|||||||
打包后的可执行文件在 `src/bin` 目录下。
|
打包后的可执行文件在 `src/bin` 目录下。
|
||||||
|
|
||||||
### 线上部署
|
### 线上部署
|
||||||
|
|
||||||
|
#### 1. 手动部署
|
||||||
|
|
||||||
部署方式跟 [快速本地部署](#快速本地部署) 一样,将打包好的可执行文件在线上服务器运行即可。
|
部署方式跟 [快速本地部署](#快速本地部署) 一样,将打包好的可执行文件在线上服务器运行即可。
|
||||||
|
|
||||||
> **特别注意:** 线上发布请记得修改配置文档中的 AccessKey, 以免给你的应用造成风险!!!
|
> **特别注意:** 线上发布请记得修改配置文档中的 AccessKey, 以免给你的应用造成风险!!!
|
||||||
@ -197,6 +200,14 @@ make linux
|
|||||||
```shell
|
```shell
|
||||||
ProxyURL = []
|
ProxyURL = []
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 2. Docker 部署
|
||||||
|
|
||||||
|
- 安装必要的工具:node, go, docker;
|
||||||
|
- 编辑 web 目录下的 `.env.production` 改为自己需要的参数;
|
||||||
|
- 在 src 目录复制 `config.sample.toml` 并命名一个新的配置文件 `config.toml`,然后编辑它改为自己需要的参数;
|
||||||
|
- 执行 `Startup.sh` 脚本。
|
||||||
|
|
||||||
### 使用 Nginx 代理
|
### 使用 Nginx 代理
|
||||||
|
|
||||||
```nginx
|
```nginx
|
||||||
|
27
Startup.sh
Normal file
27
Startup.sh
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 前端
|
||||||
|
|
||||||
|
if ! command -v node > /dev/null; then
|
||||||
|
printf 'node is not installed.\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd web
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# 后端
|
||||||
|
if ! command -v go > /dev/null; then
|
||||||
|
printf 'go is not installed.\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd src
|
||||||
|
go mod tidy
|
||||||
|
make linux
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
if ! command -v docker > /dev/null; then
|
||||||
|
printf 'docker is not installed.\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
docker compose up -d
|
13
docker-compose.yaml
Normal file
13
docker-compose.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
chatgptplus:
|
||||||
|
container_name: chatgptplus
|
||||||
|
build: ./
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./src/config.toml:/usr/src/app/config.toml
|
||||||
|
ports:
|
||||||
|
- 5678:5678
|
||||||
|
logging:
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
Loading…
Reference in New Issue
Block a user