[#1] 增加内置构建选项,使用内网apt源

This commit is contained in:
root 2025-09-16 03:56:11 +00:00
parent ee473439d5
commit d61f59b198
3 changed files with 110 additions and 8 deletions

View File

@ -3,6 +3,18 @@ FROM docker.elastic.co/elasticsearch/elasticsearch:8.13.4
# 切换到 root 用户进行系统级安装 # 切换到 root 用户进行系统级安装
USER root 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] https://10.92.132.52/mirrors/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
# 安装 supervisor # 安装 supervisor
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y supervisor && \ apt-get install -y supervisor && \

View File

@ -3,6 +3,18 @@ FROM docker.elastic.co/kibana/kibana:8.13.4
# 切换到 root 用户进行系统级安装 # 切换到 root 用户进行系统级安装
USER root 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] https://10.92.132.52/mirrors/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
# 安装 supervisor # 安装 supervisor
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y supervisor && \ apt-get install -y supervisor && \

View File

@ -1,20 +1,98 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# 帮助信息
show_help() {
cat << EOF
ARGUS Log System - Image Build Tool
Usage: $0 [OPTIONS]
Options:
--intranet Use intranet mirror for Ubuntu 22.04 packages
-h, --help Show this help message
Examples:
$0 # Build with default sources
$0 --intranet # Build with intranet mirror
EOF
}
# 解析命令行参数
use_intranet=false
while [[ $# -gt 0 ]]; do
case $1 in
--intranet)
use_intranet=true
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root" cd "$root"
echo "[INFO] Building custom Docker images with supervisor support..." echo "======================================="
echo "ARGUS Log System - Image Build Tool"
echo "======================================="
if [[ "$use_intranet" == true ]]; then
echo "🌐 Mode: Intranet (Using internal mirror: 10.92.132.52)"
build_args="--build-arg USE_INTRANET=true"
else
echo "🌐 Mode: Public (Using default package sources)"
build_args=""
fi
echo ""
# 构建 Elasticsearch 镜像 # 构建 Elasticsearch 镜像
echo "[INFO] Building Elasticsearch image..." echo "🔄 Building Elasticsearch image..."
docker build -t argus-elasticsearch:latest ./elasticsearch/build if docker build $build_args -t argus-elasticsearch:latest ./elasticsearch/build; then
echo "✅ Elasticsearch image built successfully"
else
echo "❌ Failed to build Elasticsearch image"
exit 1
fi
echo ""
# 构建 Kibana 镜像 # 构建 Kibana 镜像
echo "[INFO] Building Kibana image..." echo "🔄 Building Kibana image..."
docker build -t argus-kibana:latest ./kibana/build if docker build $build_args -t argus-kibana:latest ./kibana/build; then
echo "✅ Kibana image built successfully"
else
echo "❌ Failed to build Kibana image"
exit 1
fi
echo "[OK] Custom images built successfully:" echo ""
echo " - argus-elasticsearch:latest" echo "======================================="
echo " - argus-kibana:latest" echo "📦 Build Summary"
echo "======================================="
echo "✅ Successfully built images:"
echo " • argus-elasticsearch:latest"
echo " • argus-kibana:latest"
if [[ "$use_intranet" == true ]]; then
echo ""
echo "🌐 Built with intranet mirror configuration"
fi
echo ""
echo "🚀 Next steps:"
echo " ./scripts/save_images.sh # Export images"
echo " ./scripts/02_up.sh # Start services"
echo ""