This commit is contained in:
Tong Li 2024-03-13 17:17:59 -06:00 committed by GitHub
commit ef458d783c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 9 deletions

24
api/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM golang:1.19.0 as go-deps
WORKDIR /src
COPY go.mod .
COPY go.sum .
# 预下载依赖
RUN go mod download
# 开始第二个构建阶段,命名为 go-builder
FROM golang:1.19.0 as go-builder
WORKDIR /src
# 被 go-deps 阶段预下载的依赖会存放在此
COPY --from=go-deps /go/pkg/mod /go/pkg/mod
COPY . .
# 构建应用
RUN go build -v -o app.out main.go && ls -al
# 以 debian:stable-slim 作为基础镜像
FROM debian:stable-slim
WORKDIR /var/www/app
# 从 go-builder 阶段拷贝构建产物
COPY --from=go-builder /src/app.out /var/www/app/app
# 设置容器启动时执行的命令
CMD ["/var/www/app/app"]

View File

@ -1,5 +1,14 @@
# chatgpt-plus-go
chatgpt-plus 后端 API Go 语言实现。技术选型采用 Gin + Mysql 架构,依赖注入使用的是 fx 框架ORM 采用的是 GORM 框架。
# Docker
## build
```
docker build -t litongjava/chatgpt-plus-api:v3.2.7 .
```
## run
```
CONFIG_FILE
```
``````

View File

@ -0,0 +1,19 @@
version: '3'
services:
# 后端 API 程序
chatgpt-plus-api:
image: litongjava/chatgpt-plus-api:v3.2.7
container_name: chatgpt-plus-api
restart: always
environment:
- DEBUG=false
- LOG_LEVEL=info
- CONFIG_FILE=config.toml
ports:
- "5678:5678"
- "9999:9999"
volumes:
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
- ./conf/config.toml:/var/www/app/config.toml
- ./logs:/var/www/app/logs
- ./static:/var/www/app/static

View File

@ -1,6 +1,6 @@
Listen = "0.0.0.0:5678"
ProxyURL = "" # 如 http://127.0.0.1:7777
MysqlDns = "root:12345678@tcp(172.22.11.200:3307)/chatgpt_plus?charset=utf8&parseTime=True&loc=Local"
MysqlDns = "root:12345678@tcp(chatgpt-plus-mysql:3306)/chatgpt_plus?charset=utf8&parseTime=True&loc=Local"
StaticDir = "./static" # 静态资源的目录
StaticUrl = "/static" # 静态资源访问 URL
AesEncryptKey = ""
@ -15,9 +15,9 @@ WeChatBot = false
Password = "admin123" # 如果是生产环境的话,这里管理员的密码记得修改
[Redis] # redis 配置信息
Host = "localhost"
Host = "chatgpt-plus-redis"
Port = 6379
Password = ""
Password = "12345678"
DB = 0
[ApiConfig] # 微博热搜,今日头条等函数服务 API 配置,此为第三方插件服务,如需使用请联系作者开通
@ -126,4 +126,4 @@ WeChatBot = false
AppId = "" # 商户 ID
PrivateKey = "" # 秘钥
ApiURL = "https://payjs.cn"
NotifyURL = "https://ai.r9it.com/api/payment/payjs/notify" # 异步回调地址,域名改成你自己的
NotifyURL = "https://ai.r9it.com/api/payment/payjs/notify" # 异步回调地址,域名改成你自己的

View File

@ -25,11 +25,11 @@ services:
volumes :
- ./redis/data:/data
ports:
- "6380:6379"
- "6379:6379"
# 后端 API 程序
chatgpt-plus-api:
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-api:v3.1.8.1
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-api:v3.2.7-amd64
container_name: chatgpt-plus-api
restart: always
depends_on:
@ -50,7 +50,7 @@ services:
# 前端应用
chatgpt-plus-web:
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-web:v3.1.8.1
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/chatgpt-plus-web:v3.2.7-amd64
container_name: chatgpt-plus-web
restart: always
depends_on:
@ -62,4 +62,3 @@ services:
- ./conf/nginx/conf.d:/etc/nginx/conf.d
- ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl