Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docker-compose up -d error #169

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
11 changes: 10 additions & 1 deletion api/README.md
Original file line number Diff line number Diff line change
@@ -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
```


``````
19 changes: 19 additions & 0 deletions api/deploy/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions deploy/conf/config.toml
Original file line number Diff line number Diff line change
@@ -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 = ""
Expand All @@ -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 配置,此为第三方插件服务,如需使用请联系作者开通
Expand Down Expand Up @@ -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" # 异步回调地址,域名改成你自己的
7 changes: 3 additions & 4 deletions deploy/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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