一个基于Flask和React的爬虫管理平台,支持通过上传ZIP压缩包中的Dockerfile来创建和管理爬虫容器。
- 支持上传ZIP格式的爬虫代码包
- 自动解析压缩包中的Dockerfile
- 自动构建Docker镜像并创建容器
- 提供容器的启动、停止、删除等管理功能
- 实时监控容器状态
- Python 3.7+
- Node.js 18+
- Docker
- 安装Python依赖:
pip install -r requirements.txt
- 启动Flask服务:
python app.py
服务将在 http://localhost:5000 运行
- 进入frontend目录:
cd frontend
- 安装依赖:
npm install
- 启动开发服务器:
npm run dev
- 将爬虫代码和相关依赖打包成ZIP格式
- ZIP包根目录必须包含Dockerfile
- Dockerfile中需要正确配置爬虫运行环境和启动命令
- URL:
/upload
- 方法: POST
- 参数:
- file: ZIP格式文件
- 返回示例:
{
"message": "文件上传成功",
"path": "extracted/spider_project"
}
- URL:
/containers
- 方法: GET
- 返回示例:
[
{
"id": "container_id",
"name": "spider-project",
"status": "running",
"image": "spider-project:latest"
}
]
- URL:
/containers/create
- 方法: POST
- 参数:
{
"path": "extracted/spider_project"
}
- 返回示例:
{
"message": "容器创建成功",
"container_id": "container_id"
}
- URL:
/containers/<container_id>/action
- 方法: POST
- 参数:
{
"action": "start|stop|remove"
}
- 返回示例:
{
"message": "操作成功"
}