diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..2e98caa --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,44 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + - test-docker-build + workflow_dispatch: # Allow manual triggering + +jobs: + build-and-push: + name: Build and Push Docker Image + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: 'arm64,amd64' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: .container/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + mugglejinx/owl:latest + mugglejinx/owl:${{ github.sha }} + cache-from: type=registry,ref=mugglejinx/owl:buildcache + cache-to: type=registry,ref=mugglejinx/owl:buildcache,mode=max \ No newline at end of file diff --git a/README.md b/README.md index 6b09e12..4955dca 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,10 @@ Alternatively, you can set environment variables directly in your terminal: ## **Running with Docker** +OWL can be easily deployed using Docker, which provides a consistent environment across different platforms. + +### **Setup Instructions** + ```bash # Clone the repository git clone https://github.com/camel-ai/owl.git @@ -268,32 +272,63 @@ cd owl # Configure environment variables cp owl/.env_template owl/.env # Edit the .env file and fill in your API keys +``` -# Option 1: Using docker-compose directly -# (By default it's using pre-built online image, you can also check the docker-compose.yml for building locally) -cd .container +### **Deployment Options** +#### **Option 1: Using Pre-built Image (Recommended)** + +```bash +# This option downloads a ready-to-use image from Docker Hub +# Fastest and recommended for most users docker-compose up -d # Run OWL inside the container docker-compose exec owl bash - -# activate the virtual environment cd .. && source .venv/bin/activate - -playwright install-deps - -#run example demo script +playwright install-deps xvfb-python examples/run.py +``` -# Option 2: Build and run using the provided scripts +#### **Option 2: Building Image Locally** + +```bash +# For users who need to customize the Docker image or cannot access Docker Hub: +# 1. Open docker-compose.yml +# 2. Comment out the "image: mugglejinx/owl:latest" line +# 3. Uncomment the "build:" section and its nested properties +# 4. Then run: +docker-compose up -d --build + +# Run OWL inside the container +docker-compose exec owl bash +cd .. && source .venv/bin/activate +playwright install-deps +xvfb-python examples/run.py +``` + +#### **Option 3: Using Convenience Scripts** + +```bash +# Navigate to container directory cd .container + +# Make the script executable and build the Docker image chmod +x build_docker.sh ./build_docker.sh -# Run OWL inside the container + +# Run OWL with your question ./run_in_docker.sh "your question" ``` +### **MCP Desktop Commander Setup** + +If using MCP Desktop Commander within Docker, run: + +```bash +npx -y @wonderwhy-er/desktop-commander setup --force-file-protocol +``` + For more detailed Docker usage instructions, including cross-platform support, optimized configurations, and troubleshooting, please refer to [DOCKER_README.md](.container/DOCKER_README_en.md). # 🚀 Quick Start diff --git a/README_zh.md b/README_zh.md index 0d9598a..dfbcba1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -253,7 +253,9 @@ OWL 需要各种 API 密钥来与不同的服务进行交互。`owl/.env_templat ## **使用Docker运行** -如果您希望使用Docker运行OWL项目,我们提供了完整的Docker支持: +OWL可以通过Docker轻松部署,Docker提供了跨不同平台的一致环境。 + +### **设置说明** ```bash # 克隆仓库 @@ -263,32 +265,64 @@ cd owl # 配置环境变量 cp owl/.env_template owl/.env # 编辑.env文件,填入您的API密钥 +``` -# 选项1:直接使用docker-compose -cd .container +### **部署选项** +#### **选项1:使用预构建镜像(推荐)** + +```bash +# 此选项从Docker Hub下载一个即用型镜像 +# 最快速且推荐给大多数用户 docker-compose up -d # 在容器中运行OWL docker-compose exec owl bash - -# 激活虚拟环境 cd .. && source .venv/bin/activate - -playwright install-deps - -#运行例子演示脚本 +playwright install-deps xvfb-python examples/run.py +``` -# 选项2:使用提供的脚本构建和运行 +#### **选项2:本地构建镜像** + +```bash +# 适用于需要自定义Docker镜像或无法访问Docker Hub的用户: +# 1. 打开docker-compose.yml +# 2. 注释掉"image: mugglejinx/owl:latest"行 +# 3. 取消注释"build:"部分及其嵌套属性 +# 4. 然后运行: +docker-compose up -d --build + +# 在容器中运行OWL +docker-compose exec owl bash +cd .. && source .venv/bin/activate +playwright install-deps +xvfb-python examples/run.py +``` + +#### **选项3:使用便捷脚本** + +```bash +# 导航到容器目录 cd .container + +# 使脚本可执行并构建Docker镜像 chmod +x build_docker.sh ./build_docker.sh -# 在容器中运行OWL + +# 使用您的问题运行OWL ./run_in_docker.sh "您的问题" ``` -更多详细的Docker使用说明,包括跨平台支持、优化配置和故障排除,请参阅 [DOCKER_README.md](.container/DOCKER_README.md) +### **MCP Desktop Commander设置** + +如果在Docker中使用MCP Desktop Commander,请运行: + +```bash +npx -y @wonderwhy-er/desktop-commander setup --force-file-protocol +``` + +更多详细的Docker使用说明,包括跨平台支持、优化配置和故障排除,请参阅 [DOCKER_README.md](.container/DOCKER_README_en.md) # 🚀 快速开始