agent / Dockerfile
XJFKKK's picture
Create Dockerfile
64a4cdd verified
raw
history blame contribute delete
926 Bytes
# 选择基础镜像,这里使用官方的 Debian Slim 镜像
FROM debian:stable-slim
# 设置工作目录
WORKDIR /app
# 更新软件包列表并安装必要的软件
RUN apt-get update && \
apt-get install -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/*
# 下载哪吒 Agent 的最新版本(根据您的系统架构选择下载链接)
RUN wget -O nezha-agent.tar.gz https://github.com/naiba/nezha/releases/latest/download/nezha-agent_linux_amd64.tar.gz
# 解压缩 Agent
RUN tar -zxvf nezha-agent.tar.gz && \
rm nezha-agent.tar.gz
# 确保可执行文件具有执行权限
RUN chmod +x nezha-agent
# 设置环境变量,请根据您的实际情况替换以下值
ENV NEZHA_SERVER="your_panel_server:5555"
ENV NEZHA_KEY="your_agent_key"
ENV NEZHA_TLS="false"
# 启动哪吒 Agent
CMD ["./nezha-agent", \
"-s", "${NEZHA_SERVER}", \
"-p", "${NEZHA_KEY}", \
"-tls", "${NEZHA_TLS}"]