| FROM python:3.9-slim | |
| WORKDIR /code | |
| # 安装必要的网络工具 | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| iproute2 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 复制依赖文件 | |
| COPY requirements.txt . | |
| # 安装依赖 | |
| RUN pip install -r requirements.txt | |
| # 复制脚本文件 | |
| COPY monitor_ip.py . | |
| # 运行脚本 | |
| CMD ["python", "monitor_ip.py"] |