Co-authored-by: sundapeng.sdp <sundapeng@hashdata.cn> Reviewed-on: #18 Reviewed-by: xuxt <xuxt@zgclab.edu.cn> Reviewed-by: yuyr <yuyr@zgclab.edu.cn> Reviewed-by: huhy <husteryezi@163.com>
76 lines
2.2 KiB
Docker
76 lines
2.2 KiB
Docker
FROM ubuntu:22.04
|
|
|
|
USER root
|
|
|
|
ARG USE_INTRANET=false
|
|
|
|
# 内网 apt 源配置
|
|
RUN if [ "$USE_INTRANET" = "true" ]; then \
|
|
echo "Configuring intranet apt sources..." && \
|
|
cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
|
|
echo "deb [trusted=yes] http://10.68.64.1/ubuntu2204/ jammy main" > /etc/apt/sources.list && \
|
|
echo 'Acquire::https::Verify-Peer "false";' > /etc/apt/apt.conf.d/99disable-ssl-check && \
|
|
echo 'Acquire::https::Verify-Host "false";' >> /etc/apt/apt.conf.d/99disable-ssl-check; \
|
|
fi
|
|
|
|
# 安装常用工具和FTP服务
|
|
RUN apt-get update && \
|
|
apt-get install -y supervisor net-tools inetutils-ping vim vsftpd && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# 如果是部署环境替换 apt 源
|
|
RUN if [ "$USE_INTRANET" = "true" ]; then \
|
|
echo "deb [trusted=yes] https://10.92.132.52/mirrors/ubuntu2204/ jammy main" > /etc/apt/sources.list; \
|
|
fi
|
|
|
|
# supervisor 日志目录
|
|
RUN mkdir -p /var/log/supervisor
|
|
|
|
# 设置 FTP 基础路径环境变量
|
|
ENV FTP_BASE_PATH=/private/argus/ftp
|
|
|
|
# 设置域名环境变量
|
|
ENV DOMAIN=prom.ftp.argus.com
|
|
|
|
# 设置FTP用户密码环境变量
|
|
ENV FTP_PASSWORD=ZGClab1234!
|
|
|
|
# 设置用户和组ID环境变量
|
|
ARG FTP_UID=2133
|
|
ARG FTP_GID=2015
|
|
ENV FTP_UID=${FTP_UID}
|
|
ENV FTP_GID=${FTP_GID}
|
|
|
|
# 创建FTP用户和目录结构
|
|
RUN groupadd -g ${FTP_GID} ftpuser && \
|
|
useradd -u ${FTP_UID} -g ${FTP_GID} -d ${FTP_BASE_PATH}/share -s /bin/bash ftpuser && \
|
|
mkdir -p ${FTP_BASE_PATH}/share \
|
|
&& mkdir -p /private/argus/etc \
|
|
&& mkdir -p /var/log/vsftpd \
|
|
&& mkdir -p /var/run/vsftpd/empty \
|
|
&& chown -R ftpuser:ftpuser ${FTP_BASE_PATH}
|
|
|
|
# 创建vsftpd配置目录和用户列表文件
|
|
RUN mkdir -p /etc/vsftpd && \
|
|
echo "ftpuser" > /etc/vsftpd.userlist
|
|
|
|
# supervisor 配置
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# 启动脚本
|
|
COPY start-ftp-supervised.sh /usr/local/bin/start-ftp-supervised.sh
|
|
RUN chmod +x /usr/local/bin/start-ftp-supervised.sh
|
|
|
|
# vsftpd 配置文件
|
|
COPY vsftpd.conf /etc/vsftpd/vsftpd.conf
|
|
|
|
COPY dns-monitor.sh /usr/local/bin/dns-monitor.sh
|
|
RUN chmod +x /usr/local/bin/dns-monitor.sh
|
|
|
|
USER root
|
|
|
|
EXPOSE 21 20 21100-21110
|
|
|
|
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf", "-n"]
|