Files
IOPaint/docker-compose.mvp.yml
let5sne 81b3625fdf 添加去水印API服务 - MVP版本
新增功能:
- 精简的API服务实现(api_service_mvp.py)
  - 专注单一功能:去水印
  - 使用LaMa模型
  - API Key认证
  - 完整的错误处理和日志

- 完整的部署方案
  - Docker配置(APIDockerfile)
  - Docker Compose配置(docker-compose.mvp.yml)
  - Nginx反向代理配置

- 详尽的文档
  - API_SERVICE_GUIDE.md - MVP到商业化完整方案
  - API_SERVICE_README.md - 快速开始指南
  - API_CLIENT_EXAMPLES.md - 多语言客户端示例(Python/JS/cURL/PHP/Java/Go)

架构特点:
- 遵循MVP和KISS原则
- 提供从单机到Kubernetes的扩展路径
- 包含成本分析��收益模型
- 完整的监控和告警方案

🎯 适用场景:
- 个人/小团队快速验证产品(月成本¥300-500)
- 中小型商业化部署(月成本¥1000-3000)
- 大规模生产环境(月成本¥5000+)

🔧 Generated with Claude Code
2025-11-28 17:46:23 +00:00

82 lines
1.9 KiB
YAML
Raw Permalink 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:
# ==================== API服务 ====================
api:
build:
context: .
dockerfile: docker/APIDockerfile
container_name: iopaint-api
restart: unless-stopped
ports:
- "8080:8080"
environment:
# API配置
- API_KEY=${API_KEY:-change_me_in_production}
- MAX_IMAGE_SIZE=${MAX_IMAGE_SIZE:-4096}
- ENABLE_METRICS=true
# 模型缓存使用HuggingFace镜像加速下载
- HF_ENDPOINT=https://hf-mirror.com
- HF_HOME=/root/.cache
# PyTorch配置
- PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
volumes:
# 模型缓存目录(避免每次重启重新下载模型)
- ./models:/root/.cache:rw
# 日志目录
- ./logs:/app/logs:rw
deploy:
resources:
limits:
cpus: '4'
memory: 8G
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# 健康检查
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# ==================== Nginx反向代理可选====================
nginx:
image: nginx:alpine
container_name: iopaint-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro # SSL证书目录
- ./nginx/logs:/var/log/nginx:rw
depends_on:
- api
profiles:
- production # 使用 docker-compose --profile production up 启动
# ==================== 数据卷 ====================
volumes:
models:
driver: local
logs:
driver: local
# ==================== 网络 ====================
networks:
default:
name: iopaint-network