Openclaw / Dockerfile
zhiliao000's picture
Update Dockerfile
2036258 verified
Raw
History Blame Contribute Delete
1.05 kB
# 1. 使用 Playwright 官方镜像,它自带了浏览器运行环境,是模拟 WhatsApp 的基础
FROM mcr.microsoft.com/playwright:v1.40.0-jammy
# 2. 安装 Python 环境 (OpenClaw 通常是 Python 项目)
RUN apt-get update && apt-get install -y python3 python3-pip && \
rm -rf /var/lib/apt/lists/*
# 3. 设置容器内的工作目录
WORKDIR /app
# 4. 复制项目文件
# 注意:这一步会把你的代码和依赖文件复制进去
COPY . .
# 5. 自动创建一个简单的 requirements.txt (如果你的项目中没有的话)
# 确保安装了调用 OpenRouter 和 WhatsApp 自动化所需的库
RUN pip3 install --no-cache-dir \
openai \
playwright \
flask \
python-dotenv
# 6. 安装 Chromium 浏览器
RUN playwright install chromium
# 7. 暴露端口(如果 OpenClaw 有 Web 界面或 Webhook)
EXPOSE 7860
# 8. 启动脚本
# 假设你的主程序是 main.py。
# 注意:我们需要确保浏览器以 --no-sandbox 模式运行才能在 Docker 里成功打开 WhatsApp
CMD ["python3", "main.py"]