Files
owl/.container/docker-compose.yml
2025-03-10 13:54:59 +08:00

52 lines
2.1 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.

services:
owl:
build:
context: ..
dockerfile: .container/Dockerfile
args:
# 构建参数 | Build arguments
BUILDKIT_INLINE_CACHE: 1
# 使用BuildKit加速构建 | Use BuildKit to accelerate build
cache_from:
- python:3.10-slim
volumes:
# 挂载.env文件方便配置API密钥 | Mount .env file for easy API key configuration
- ./owl/.env:/app/owl/.env
# 可选:挂载数据目录 | Optional: Mount data directory
- ./data:/app/data
# 挂载缓存目录,避免重复下载 | Mount cache directories to avoid repeated downloads
- playwright-cache:/root/.cache/ms-playwright
- pip-cache:/root/.pip/cache
environment:
# 可以在这里设置环境变量,覆盖.env文件中的设置 | Set environment variables here to override settings in .env file
- OPENAI_API_KEY=${OPENAI_API_KEY}
# 添加显示相关的环境变量 | Add display-related environment variables
- DISPLAY=:99
- PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
# 设置Python不生成.pyc文件减少磁盘IO | Set Python to not generate .pyc files, reduce disk IO
- PYTHONDONTWRITEBYTECODE=1
# 设置Python不缓冲输出方便查看日志 | Set Python to not buffer output for easier log viewing
- PYTHONUNBUFFERED=1
# 设置终端颜色 | Set terminal color
- TERM=xterm-256color
# 启用pip缓存 | Enable pip cache
- PIP_CACHE_DIR=/root/.pip/cache
ports:
# 如果项目有Web界面可以映射端口 | If the project has a web interface, map ports
- "8000:8000"
# 使用交互模式运行容器 | Run container in interactive mode
stdin_open: true
tty: true
# 添加共享内存大小,提高浏览器性能 | Add shared memory size to improve browser performance
shm_size: 2gb
# 设置资源限制 | Set resource limits
deploy:
resources:
limits:
cpus: '2'
memory: 4G
# 定义持久化卷,用于缓存 | Define persistent volumes for caching
volumes:
playwright-cache:
pip-cache: