FROM ubuntu # 设置环境变量,避免交互式配置 ARG DEBIAN_FRONTEND=noninteractive # 设置时区为亚洲/上海 ENV TZ=Asia/Shanghai RUN rm -rf /var/lib/apt/lists/* # 安装必要的工具 RUN apt-get update && \ apt-get install -y wget gnupg && \ rm -rf /var/lib/apt/lists/* # 添加 Webmin 的 GPG 密钥 RUN wget https://download.webmin.com/jcameron-key.asc && \ apt-key add jcameron-key.asc # 添加 Webmin 的源 RUN echo "deb https://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list.d/webmin.list # 安装所需的软件包并清理APT缓存 RUN apt-get update && apt-get install -y \ wget \ python-is-python3 \ pip \ tar \ unzip \ zip \ curl \ git \ sudo \ gosu \ gnupg \ util-linux \ sqlite3 \ tzdata \ webmin # 下载并执行 install.sh 脚本 # 同时运行 python main.py 和 bash install.sh # RUN python main.py & \ # bash quick_start.sh # 创建一个启动脚本 RUN echo '#!/bin/bash' > /start-webmin.sh && \ echo 'mkdir -p /var/log/webmin' >> /start-webmin.sh && \ echo 'chown root:root /var/log/webmin' >> /start-webmin.sh && \ echo 'chmod 755 /var/log/webmin' >> /start-webmin.sh && \ echo 'service webmin start' >> /start-webmin.sh && \ echo 'tail -f /var/log/webmin/miniserv.log' >> /start-webmin.sh && \ chmod +x /start-webmin.sh # 设置工作目录为/app WORKDIR /app COPY . . # 安装任何需要的包,使用 --ignore-installed 选项 RUN pip install --no-cache-dir --ignore-installed --break-system-packages -r requirements.txt EXPOSE 7860 # 使用 ENTRYPOINT 和 CMD 组合来启动 Webmin ENTRYPOINT ["/start-webmin.sh"] # CMD ["sh", "-c", "python main.py"]