File size: 2,035 Bytes
d457e1e f1046c7 be96286 e843ed0 d457e1e 8beb0b9 22ddbb9 335473a d457e1e d03c38d e9ab03d 30ad7ec 9da58c6 7f15d82 30ad7ec f2051ab 30ad7ec f1046c7 b549e0f f1046c7 1501761 e375a4a f1046c7 3c92ffa f1046c7 b549e0f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
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 mkdir -p /var/log/webmin && \
chown root:root /var/log/webmin && \
chmod 755 /var/log/webmin
# 确保配置文件存在且权限正确
# 创建非特权用户
RUN useradd -m -s /bin/bash webminuser
RUN touch /etc/webmin/miniserv.conf && \
chown root:root /etc/webmin/miniserv.conf && \
chmod 644 /etc/webmin/miniserv.conf \
chown -R webminuser:webminuser /etc/webmin && \
chown -R webminuser:webminuser /var/log/webmin
# 创建一个启动脚本
RUN echo '#!/bin/bash' > /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"] |