mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-19 09:46:39 +08:00
docs: 增加 docker-compose 部署支持
This commit is contained in:
parent
133a127d8a
commit
da0acfe851
11
Dockerfile
11
Dockerfile
@ -1,11 +0,0 @@
|
||||
# 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"]
|
27
Startup.sh
27
Startup.sh
@ -1,27 +0,0 @@
|
||||
# 前端
|
||||
|
||||
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
|
@ -1,13 +0,0 @@
|
||||
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"
|
17
docker/conf/config.toml
Normal file
17
docker/conf/config.toml
Normal file
@ -0,0 +1,17 @@
|
||||
Listen = "0.0.0.0:5678"
|
||||
ProxyURL = "http://127.0.0.1:7777"
|
||||
MysqlDns = "root:12345678@tcp(192.168.3.200:3306)/chatgpt_plus?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
|
||||
[Session]
|
||||
SecretKey = "8k0c67y2or1n7kbmn1w1c86ygqscguoktuf9t524jm64ls585z8uibpdssiy128s"
|
||||
Name = "CHAT_PLUS_SESSION"
|
||||
Path = "/"
|
||||
Domain = "localhost"
|
||||
MaxAge = 86400
|
||||
Secure = false
|
||||
HttpOnly = false
|
||||
SameSite = 2
|
||||
|
||||
[Manager]
|
||||
Username = "admin"
|
||||
Password = "admin123"
|
46
docker/conf/nginx/conf.d/chatgpt-plus.conf
Normal file
46
docker/conf/nginx/conf.d/chatgpt-plus.conf
Normal file
@ -0,0 +1,46 @@
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'websocket' upgrade;
|
||||
}
|
||||
server {
|
||||
# listen 443 ssl;
|
||||
listen 8080;
|
||||
# server_name www.chatgpt.com; #替换成你自己的域名
|
||||
|
||||
# ssl_certificate xxx.pem; # 替换成自己的 SSL 证书
|
||||
# ssl_certificate_key xxx.key;
|
||||
# ssl_session_timeout 5m;
|
||||
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
||||
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
|
||||
# 日志地址
|
||||
access_log /var/log/access.log;
|
||||
error_log /var/log/error.log;
|
||||
|
||||
index index.html;
|
||||
root /var/www/app/dist; # 这里改成前端静态页面的地址
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# 这里配置后端 API 的转发
|
||||
location /api/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 12s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
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 地址
|
||||
}
|
||||
}
|
||||
|
||||
# 关闭静态资源的日志
|
||||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$ {
|
||||
access_log off;
|
||||
}
|
||||
}
|
57
docker/conf/nginx/nginx.conf
Normal file
57
docker/conf/nginx/nginx.conf
Normal file
@ -0,0 +1,57 @@
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
31
docker/docker-compose.yaml
Normal file
31
docker/docker-compose.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
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
|
||||
container_name: chatgpt-plus-go
|
||||
#build: ./
|
||||
restart: always
|
||||
# network_mode: host
|
||||
ports:
|
||||
- "5678: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
|
||||
container_name: chatgpt-plus-vue
|
||||
#build: ./
|
||||
restart: always
|
||||
# network_mode: host
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./logs/nginx:/var/log/nginx
|
||||
- ./conf/nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./ssl:/etc/nginx/ssl
|
||||
|
12
docker/dockerfile-go-api
Normal file
12
docker/dockerfile-go-api
Normal file
@ -0,0 +1,12 @@
|
||||
# GO api docker 镜像创建
|
||||
FROM ubuntu:22.04
|
||||
|
||||
MAINTAINER yangjian<yangjian102621@163.com>
|
||||
|
||||
WORKDIR /var/www/app
|
||||
COPY ./api/go/bin/chatgpt-v3-amd64-linux /var/www/app
|
||||
|
||||
EXPOSE 5678
|
||||
|
||||
# 容器启动时执行的命令
|
||||
CMD ["./chatgpt-v3-amd64-linux"]
|
9
docker/dockerfile-vue
Normal file
9
docker/dockerfile-vue
Normal file
@ -0,0 +1,9 @@
|
||||
# 前端 Vue 项目构建
|
||||
FROM nginx:1.20.2
|
||||
|
||||
MAINTAINER yangjian<yangjian102621@163.com>
|
||||
|
||||
WORKDIR /var/www/app
|
||||
COPY ./web/dist /var/www/app/dist
|
||||
|
||||
EXPOSE 80 443 8080
|
1
web/.gitignore
vendored
1
web/.gitignore
vendored
@ -7,5 +7,6 @@ lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist.tar.gz
|
||||
.env.development
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user