maxkb/dev/docker-compose.yml
2025-08-22 17:40:47 +08:00

78 lines
2.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
services:
maxkb-dev:
# 使用生产镜像或本地构建的镜像
image: maxkb-local:latest
# 如果需要本地构建,取消下面两行注释
# build:
# context: ../
# dockerfile: installer/Dockerfile
container_name: maxkb-dev
ports:
- "8080:8080"
volumes:
# 挂载Python源码实现热重载
- ../apps:/opt/maxkb-app/apps
- ../main.py:/opt/maxkb-app/main.py
- ../installer/maxkb.py:/opt/maxkb-app/maxkb.py
# 挂载UI源码用于前端开发
- ../ui/src:/opt/maxkb-app/ui/src
- ../ui/public:/opt/maxkb-app/ui/public
# 持久化数据
- maxkb_data:/opt/maxkb/data
# 开发配置
- ./dev.env:/opt/maxkb-app/.env
environment:
# 开发环境变量
DJANGO_DEBUG: "True"
PYTHONUNBUFFERED: "1"
MAXKB_LOG_LEVEL: "DEBUG"
# 数据库配置使用内置的PostgreSQL
MAXKB_DB_HOST: "127.0.0.1"
MAXKB_DB_PORT: "5432"
MAXKB_DB_NAME: "maxkb"
MAXKB_DB_USER: "root"
MAXKB_DB_PASSWORD: "Password123@postgres"
# Redis配置使用内置的Redis
MAXKB_REDIS_HOST: "127.0.0.1"
MAXKB_REDIS_PORT: "6379"
MAXKB_REDIS_PASSWORD: "Password123@redis"
# 使用默认的启动命令,让容器内的所有服务正常启动
# command 留空使用镜像默认的 entrypoint
networks:
- maxkb-network
# 独立的前端开发服务器(可选)
frontend-dev:
image: node:20-alpine
container_name: maxkb-frontend-dev
working_dir: /app
volumes:
- ../ui:/app
- /app/node_modules # 防止覆盖node_modules
ports:
- "5173:5173" # Vite开发服务器
- "5174:5174" # Chat界面开发服务器
environment:
- VITE_APP_BASE_URL=http://localhost:8080
command: >
sh -c "
npm config set registry https://registry.npmmirror.com &&
npm install &&
npm run dev
"
networks:
- maxkb-network
volumes:
maxkb_data:
networks:
maxkb-network:
driver: bridge