You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

78 lines
2.3 KiB

services:
postgres:
image: postgres:16-alpine
container_name: ent-postgres
restart: always
entrypoint: >
sh -c '
if [ ! -f /usr/local/share/postgresql/extension/vector.control ]; then
echo ">>> pgvector 未安装,正在编译安装(仅首次约 30 秒)..."
apk add --no-cache --virtual .pg_build git build-base postgresql16-dev clang llvm-dev > /dev/null 2>&1
wget -qO- https://github.com/pgvector/pgvector/archive/refs/tags/v0.7.4.tar.gz | tar xz -C /tmp
cd /tmp/pgvector-0.7.4 && make -j2 > /dev/null 2>&1 && make install > /dev/null 2>&1
cd / && rm -rf /tmp/pgvector-0.7.4
apk del .pg_build > /dev/null 2>&1
echo ">>> pgvector 安装完成"
fi
exec docker-entrypoint.sh postgres
'
environment:
POSTGRES_USER: enterprise
POSTGRES_PASSWORD: enterprise123
POSTGRES_DB: enterprise_ai
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db:/docker-entrypoint-initdb.d
ports:
- "5431:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U enterprise"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: ent-redis
restart: always
command: redis-server --appendonly yes --requirepass redis123
volumes:
- redis_data:/data
ports:
- "6378:6379"
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: ent-backend
restart: always
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
environment:
DATABASE_URL: postgresql+asyncpg://enterprise:enterprise123@postgres:5432/enterprise_ai
REDIS_URL: redis://:redis123@redis:6379/0
JWT_SECRET: dev-secret-key-change-in-production-32chars
LLM_API_KEY: ${LLM_API_KEY:-sk-placeholder}
LLM_API_BASE: ${LLM_API_BASE:-https://api.openai.com/v1}
LLM_MODEL: ${LLM_MODEL:-gpt-4o-mini}
ports:
- "8100:8000"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.prod
container_name: ent-frontend
restart: always
depends_on:
- backend
ports:
- "80:80"
volumes:
postgres_data:
redis_data: