[#50] 完成在x86_64平台上使用buildx来构建arm镜像;重新构建了core/web/prom/grafana以及cpu node镜像;跑通swarm test for arm; 暂时移除dcgm和log路径功能
This commit is contained in:
54
src/sys/build/arm-cpu-node/Dockerfile
Normal file
54
src/sys/build/arm-cpu-node/Dockerfile
Normal file
@@ -0,0 +1,54 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG USE_INTRANET=false
|
||||
ARG ARGUS_BUILD_UID=2133
|
||||
ARG ARGUS_BUILD_GID=2015
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
TZ=Asia/Shanghai \
|
||||
ARGUS_BUILD_UID=${ARGUS_BUILD_UID} \
|
||||
ARGUS_BUILD_GID=${ARGUS_BUILD_GID} \
|
||||
ARGUS_LOGS_WORLD_WRITABLE=1
|
||||
|
||||
# 可选:构建期切换内网源
|
||||
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
|
||||
|
||||
# 安装基础工具与 node-exporter(使用发行版提供的 prometheus-node-exporter)
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl wget iproute2 iputils-ping net-tools jq tzdata \
|
||||
procps python3 python3-pip \
|
||||
prometheus-node-exporter; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# 拷贝 agent 源码到镜像内,以 Python 解释器直接运行 entry.py
|
||||
COPY src/agent/ /opt/argus-agent/
|
||||
|
||||
RUN set -eux; \
|
||||
python3 -m pip install --no-cache-dir --upgrade pip && \
|
||||
python3 -m pip install --no-cache-dir requests==2.31.0 tomli
|
||||
|
||||
RUN set -eux; \
|
||||
mkdir -p /private/argus/agent /logs/train /logs/infer /buffers; \
|
||||
if [ "$ARGUS_LOGS_WORLD_WRITABLE" = "1" ]; then \
|
||||
chmod 1777 /logs/train /logs/infer || true; \
|
||||
else \
|
||||
chmod 755 /logs/train /logs/infer || true; \
|
||||
fi; \
|
||||
chmod 770 /buffers || true
|
||||
|
||||
COPY src/sys/build/arm-cpu-node/start-arm-cpu-node.sh /usr/local/bin/start-arm-cpu-node.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/start-arm-cpu-node.sh
|
||||
|
||||
EXPOSE 9100
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/start-arm-cpu-node.sh"]
|
||||
30
src/sys/build/arm-cpu-node/start-arm-cpu-node.sh
Normal file
30
src/sys/build/arm-cpu-node/start-arm-cpu-node.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
LOG_DIR=/var/log
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
echo "[BOOT] ARM CPU node container starting"
|
||||
|
||||
# 选择 node-exporter 可执行文件名称
|
||||
if command -v node-exporter >/dev/null 2>&1; then
|
||||
NODE_EXPORTER_BIN="node-exporter"
|
||||
elif command -v prometheus-node-exporter >/dev/null 2>&1; then
|
||||
NODE_EXPORTER_BIN="prometheus-node-exporter"
|
||||
else
|
||||
echo "[BOOT][ERROR] node-exporter binary not found in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[BOOT] starting ${NODE_EXPORTER_BIN} on :9100"
|
||||
"${NODE_EXPORTER_BIN}" --web.listen-address=":9100" >/var/log/node-exporter.log 2>&1 &
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
echo "[BOOT] starting argus-agent (python entry.py)"
|
||||
python3 /opt/argus-agent/entry.py >>/var/log/argus-agent.log 2>&1 &
|
||||
else
|
||||
echo "[BOOT][ERROR] python3 not found; cannot start argus-agent" >&2
|
||||
fi
|
||||
|
||||
echo "[BOOT] services started; tailing logs"
|
||||
exec tail -F /var/log/node-exporter.log /var/log/argus-agent.log 2>/dev/null || exec tail -F /dev/null
|
||||
Reference in New Issue
Block a user