92 lines
2.4 KiB
YAML
92 lines
2.4 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
# PostgreSQL - 共用資料庫(支援 pgvector)
|
||
postgres:
|
||
image: pgvector/pgvector:pg15
|
||
container_name: tobiichiGPT-postgres
|
||
restart: unless-stopped
|
||
environment:
|
||
POSTGRES_DB: tobiichiGPT
|
||
POSTGRES_USER: tobiichi3227
|
||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||
volumes:
|
||
- /mnt/data/External/tobiichiGPT/db_data:/var/lib/postgresql/data
|
||
networks:
|
||
- tobiichiGPT-network
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U tobiichi3227"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
# API 轉接層 - 偽裝 OpenAI API
|
||
api:
|
||
image: python:3.11-slim
|
||
container_name: tobiichiGPT-api
|
||
restart: unless-stopped
|
||
ports:
|
||
- "18000:8000"
|
||
environment:
|
||
- DB_HOST=postgres
|
||
- DB_PORT=5432
|
||
- DB_NAME=tobiichiGPT
|
||
- DB_USER=tobiichi3227
|
||
- DB_PASSWORD=${DB_PASSWORD}
|
||
- PAPERCUPS_URL=http://papercups:4000
|
||
- PAPERCUPS_API_TOKEN=${PAPERCUPS_API_TOKEN}
|
||
volumes:
|
||
- /mnt/data/External/tobiichiGPT/api_data:/app
|
||
working_dir: /app
|
||
command: >
|
||
sh -c "
|
||
pip install --no-cache-dir -r requirements.txt &&
|
||
python server.py
|
||
"
|
||
networks:
|
||
- tobiichiGPT-network
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
|
||
# Open WebUI - 用戶對話介面
|
||
openwebui:
|
||
image: ghcr.io/open-webui/open-webui:main
|
||
container_name: tobiichiGPT-ui
|
||
restart: unless-stopped
|
||
ports:
|
||
- "10060:8080"
|
||
environment:
|
||
- DATABASE_URL=postgresql://tobiichi3227:${DB_PASSWORD}@postgres:5432/tobiichiGPT
|
||
- WEBUI_AUTH=True
|
||
volumes:
|
||
- /mnt/data/External/tobiichiGPT/ui_data:/app/backend/data
|
||
networks:
|
||
- tobiichiGPT-network
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
|
||
# Papercups - 管理員對話介面
|
||
papercups:
|
||
image: papercups/papercups:latest
|
||
container_name: tobiichiGPT-papercups
|
||
restart: unless-stopped
|
||
ports:
|
||
- "14000:4000"
|
||
environment:
|
||
- DATABASE_URL=postgresql://tobiichi3227:${DB_PASSWORD}@postgres:5432/papercups
|
||
- SECRET_KEY_BASE=${PAPERCUPS_SECRET_KEY}
|
||
- BACKEND_URL=http://localhost:14000
|
||
- MIX_ENV=prod
|
||
networks:
|
||
- tobiichiGPT-network
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
|
||
networks:
|
||
tobiichiGPT-network:
|
||
driver: bridge
|
||
name: tobiichiGPT-network # 固定網路名稱,讓 proxy stack 可以連接
|