mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-27 21:56:39 +08:00
add backend dockerfile
This commit is contained in:
parent
085d96d855
commit
2c85766389
24
api/Dockerfile
Normal file
24
api/Dockerfile
Normal 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"]
|
@ -1,5 +1,14 @@
|
|||||||
# chatgpt-plus-go
|
# chatgpt-plus-go
|
||||||
|
|
||||||
chatgpt-plus 后端 API Go 语言实现。技术选型采用 Gin + Mysql 架构,依赖注入使用的是 fx 框架,ORM 采用的是 GORM 框架。
|
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
api/deploy/docker-compose.yaml
Normal file
19
api/deploy/docker-compose.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user