From a7c4c06d4e247ae1d860e316a4e307afbabbcc82 Mon Sep 17 00:00:00 2001 From: Wendong Date: Sun, 16 Mar 2025 02:44:02 +0800 Subject: [PATCH] update docker setting --- .container/.dockerignore | 10 +++++----- .container/build_docker.bat | 10 +++++----- .container/build_docker.sh | 8 ++++---- .container/check_docker.sh | 8 ++++---- .container/docker-compose.yml | 4 ++-- README.md | 2 +- README_zh.md | 2 +- examples/__init__.py | 0 8 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 examples/__init__.py diff --git a/.container/.dockerignore b/.container/.dockerignore index 4f6c16c..77295fc 100644 --- a/.container/.dockerignore +++ b/.container/.dockerignore @@ -35,7 +35,7 @@ var/ .coverage htmlcov/ -# 虚拟环境 +# Virtual environments venv/ ENV/ env/ @@ -48,18 +48,18 @@ env/ *.swo .DS_Store -# 临时文件 +# Temporary files temp_* *.tmp *.log *.bak -# 缓存 +# Cache .cache/ .npm/ .yarn/ -# 大型数据文件 +# Large data files *.csv *.sqlite *.db @@ -70,5 +70,5 @@ temp_* *.pkl *.pickle -# 数据目录 +# Data directory data/ \ No newline at end of file diff --git a/.container/build_docker.bat b/.container/build_docker.bat index 6efb01b..fd61307 100644 --- a/.container/build_docker.bat +++ b/.container/build_docker.bat @@ -5,6 +5,11 @@ setlocal enabledelayedexpansion echo 在Windows上构建Docker镜像... echo Building Docker image on Windows... +REM 设置Docker BuildKit环境变量 +REM Set Docker BuildKit environment variables +set DOCKER_BUILDKIT=1 +set COMPOSE_DOCKER_CLI_BUILD=1 + REM 设置配置变量 REM Set configuration variables set CACHE_DIR=.docker-cache\pip @@ -110,11 +115,6 @@ if %ERRORLEVEL% EQU 0 ( ) ) -REM 设置Docker BuildKit环境变量 -REM Set Docker BuildKit environment variables -set DOCKER_BUILDKIT=1 -set COMPOSE_DOCKER_CLI_BUILD=1 - echo 启用Docker BuildKit加速构建... echo Enabling Docker BuildKit to accelerate build... diff --git a/.container/build_docker.sh b/.container/build_docker.sh index 837087b..1649faf 100755 --- a/.container/build_docker.sh +++ b/.container/build_docker.sh @@ -8,6 +8,10 @@ CLEAN_CACHE=0 REBUILD=0 SERVICE="" +# 设置Docker BuildKit环境变量 | Set Docker BuildKit environment variables +export DOCKER_BUILDKIT=1 +export COMPOSE_DOCKER_CLI_BUILD=1 + # 解析命令行参数 | Parse command line arguments while [[ $# -gt 0 ]]; do case "$1" in @@ -65,10 +69,6 @@ if [ ! -f "$COMPOSE_FILE" ]; then exit 1 fi -# 设置Docker BuildKit环境变量 | Set Docker BuildKit environment variables -export DOCKER_BUILDKIT=1 -export COMPOSE_DOCKER_CLI_BUILD=1 - echo "启用Docker BuildKit加速构建... | Enabling Docker BuildKit to accelerate build..." # 清理缓存(如果指定) | Clean cache (if specified) diff --git a/.container/check_docker.sh b/.container/check_docker.sh index d44af85..3d04f47 100755 --- a/.container/check_docker.sh +++ b/.container/check_docker.sh @@ -73,11 +73,11 @@ FREE_SPACE=$(df -h . | awk 'NR==2 {print $4}') echo "可用磁盘空间 | Available disk space: $FREE_SPACE" # 检查是否有.env文件 | Check if .env file exists -if [ ! -f "owl/.env" ]; then - echo "警告 | Warning: 未找到owl/.env文件 | owl/.env file not found" +if [ ! -f "../owl/.env" ]; then + echo "警告 | Warning: 未找到../owl/.env文件 | ../owl/.env file not found" echo "请运行以下命令创建环境变量文件 | Please run the following command to create environment variable file:" - echo "cp owl/.env_template owl/.env" - echo "然后编辑owl/.env文件,填写必要的API密钥 | Then edit owl/.env file and fill in necessary API keys" + echo "cp ../owl/.env_template ../owl/.env" + echo "然后编辑../owl/.env文件,填写必要的API密钥 | Then edit ../owl/.env file and fill in necessary API keys" else echo "环境变量文件已存在 | Environment variable file exists" fi diff --git a/.container/docker-compose.yml b/.container/docker-compose.yml index e099627..459fb6d 100644 --- a/.container/docker-compose.yml +++ b/.container/docker-compose.yml @@ -13,7 +13,7 @@ services: # 挂载.env文件,方便配置API密钥 - ../owl/.env:/app/owl/.env # 挂载数据目录 - - ./data:/app/data + - ./data:/app/owl/data # 挂载缓存目录,避免重复下载 - ~/.cache/pip:/root/.pip/cache - ~/.cache/playwright:/root/.cache/ms-playwright @@ -24,7 +24,7 @@ services: - PYTHONUNBUFFERED=1 - TERM=xterm-256color ports: - - "8000:8000" + - "7860:7860" stdin_open: true tty: true shm_size: 2gb diff --git a/README.md b/README.md index 954fe8d..6b09e12 100644 --- a/README.md +++ b/README.md @@ -279,7 +279,7 @@ docker-compose up -d docker-compose exec owl bash # activate the virtual environment -cd .. && source .venv/bin/activate && cd owl +cd .. && source .venv/bin/activate playwright install-deps diff --git a/README_zh.md b/README_zh.md index c52da43..0d9598a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -273,7 +273,7 @@ docker-compose up -d docker-compose exec owl bash # 激活虚拟环境 -cd .. && source .venv/bin/activate && cd owl +cd .. && source .venv/bin/activate playwright install-deps diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000..e69de29