docker compose
This commit is contained in:
63
README.md
63
README.md
@@ -1,5 +1,12 @@
|
||||
|
||||
|
||||
```shell
|
||||
protoc \
|
||||
--go_out=. --go_opt=paths=source_relative \
|
||||
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
||||
./proto/xxx.proto
|
||||
```
|
||||
|
||||
```shell
|
||||
# chatgpt-web-backend
|
||||
go mod tidy
|
||||
@@ -12,12 +19,68 @@ go run cmd/main.go \
|
||||
--openai-presence-penalty 0 \
|
||||
--openai-frequency-penalty 0
|
||||
|
||||
docker build -t chatgpt-web-backend:1.0.0 .
|
||||
|
||||
docker run -d --name chatgpt-web-backend \
|
||||
-p 7080:7080 \
|
||||
chatgpt-web-backend:1.0.0 \
|
||||
/app/server \
|
||||
--frontend-path www \
|
||||
--openapi-key "$MOONSHOT_API_KEY" \
|
||||
--openapi-base-url https://api.moonshot.cn/v1 \
|
||||
--openai-model kimi-k2.5 \
|
||||
--openai-temperature 100 \
|
||||
--openai-presence-penalty 0 \
|
||||
--openai-frequency-penalty 0
|
||||
|
||||
# chatgpt-web-frontend
|
||||
HUSKY=0 pnpm bootstrap
|
||||
pnpm dev
|
||||
|
||||
docker build -t chatgpt-web-frontend:1.0.0 .
|
||||
|
||||
# tokenizer
|
||||
docker build -t tokenizer:1.0.0 .
|
||||
|
||||
# keywords-filter
|
||||
docker build -t keywords-filter:1.0.0 .
|
||||
```
|
||||
|
||||
|
||||
## backend
|
||||
访问 tokenizer
|
||||
```go
|
||||
url := fmt.Sprintf("http://127.0.0.1:5000/tokenizer/%s", model)
|
||||
// 改成
|
||||
tokenizerBaseURL := os.Getenv("TOKENIZER_BASE_URL")
|
||||
if tokenizerBaseURL == "" {
|
||||
tokenizerBaseURL = "http://tokenizer:3002"
|
||||
}
|
||||
url := fmt.Sprintf("%s/tokenizer/%s", tokenizerBaseURL, model)
|
||||
// 直接访问 tokenizer
|
||||
```
|
||||
|
||||
## frontend
|
||||
访问 backend
|
||||
```conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_http_version 1.1;
|
||||
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 X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://chatgpt-web-backend:7080/api/;
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user