Create Dockerfile
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 选择基础镜像,这里使用官方的 Debian Slim 镜像
|
2 |
+
FROM debian:stable-slim
|
3 |
+
|
4 |
+
# 设置工作目录
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# 更新软件包列表并安装必要的软件
|
8 |
+
RUN apt-get update && \
|
9 |
+
apt-get install -y wget ca-certificates && \
|
10 |
+
rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# 下载哪吒 Agent 的最新版本(根据您的系统架构选择下载链接)
|
13 |
+
RUN wget -O nezha-agent.tar.gz https://github.com/naiba/nezha/releases/latest/download/nezha-agent_linux_amd64.tar.gz
|
14 |
+
|
15 |
+
# 解压缩 Agent
|
16 |
+
RUN tar -zxvf nezha-agent.tar.gz && \
|
17 |
+
rm nezha-agent.tar.gz
|
18 |
+
|
19 |
+
# 确保可执行文件具有执行权限
|
20 |
+
RUN chmod +x nezha-agent
|
21 |
+
|
22 |
+
# 设置环境变量,请根据您的实际情况替换以下值
|
23 |
+
ENV NEZHA_SERVER="your_panel_server:5555"
|
24 |
+
ENV NEZHA_KEY="your_agent_key"
|
25 |
+
ENV NEZHA_TLS="false"
|
26 |
+
|
27 |
+
# 启动哪吒 Agent
|
28 |
+
CMD ["./nezha-agent", \
|
29 |
+
"-s", "${NEZHA_SERVER}", \
|
30 |
+
"-p", "${NEZHA_KEY}", \
|
31 |
+
"-tls", "${NEZHA_TLS}"]
|