- [x] 完成log模块镜像构建、本地端到端写日志——收集——查询流程; - [x] 完成bind模块构建; - [x] 内置域名IP自动更新脚本,使用 /private/argus/etc目录下文件进行同步,容器启动时自动写IP,定时任务刷新更新DNS服务器IP和DNS规则; Co-authored-by: root <root@curious.host.com> Reviewed-on: #8 Reviewed-by: sundapeng <sundp@mail.zgclab.edu.cn>
67 lines
2.1 KiB
Docker
67 lines
2.1 KiB
Docker
FROM ubuntu:22.04
|
|
|
|
# Set timezone and avoid interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
# 设置构建参数
|
|
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
|
|
|
|
# Update package list and install required packages
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
bind9 \
|
|
bind9utils \
|
|
bind9-doc \
|
|
supervisor \
|
|
net-tools \
|
|
inetutils-ping \
|
|
vim \
|
|
&& 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
|
|
|
|
# Create supervisor configuration directory
|
|
RUN mkdir -p /etc/supervisor/conf.d
|
|
|
|
# Copy supervisor configuration
|
|
COPY src/bind/build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
# Copy BIND9 configuration files
|
|
COPY src/bind/build/named.conf.local /etc/bind/named.conf.local
|
|
COPY src/bind/build/db.argus.com /etc/bind/db.argus.com
|
|
|
|
# Copy startup and reload scripts
|
|
COPY src/bind/build/startup.sh /usr/local/bin/startup.sh
|
|
COPY src/bind/build/reload-bind9.sh /usr/local/bin/reload-bind9.sh
|
|
COPY src/bind/build/argus_dns_sync.sh /usr/local/bin/argus_dns_sync.sh
|
|
COPY src/bind/build/update-dns.sh /usr/local/bin/update-dns.sh
|
|
|
|
# Make scripts executable
|
|
RUN chmod +x /usr/local/bin/startup.sh /usr/local/bin/reload-bind9.sh /usr/local/bin/argus_dns_sync.sh /usr/local/bin/update-dns.sh
|
|
|
|
# Set proper ownership for BIND9 files
|
|
RUN chown bind:bind /etc/bind/named.conf.local /etc/bind/db.argus.com
|
|
|
|
# Expose DNS port
|
|
EXPOSE 53/tcp 53/udp
|
|
|
|
# Use root user as requested
|
|
USER root
|
|
|
|
# Start with startup script
|
|
CMD ["/usr/local/bin/startup.sh"]
|