tianzijian commited on
Commit
5905809
·
verified ·
1 Parent(s): b32933e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -15
Dockerfile CHANGED
@@ -4,6 +4,9 @@ LABEL maintainer="Hermes Agent Community"
4
  LABEL version="0.10.0"
5
  LABEL description="Hermes Agent v0.10.0 with Web UI on Hugging Face Spaces"
6
 
 
 
 
7
  # ==================== 环境变量 ====================
8
  ENV PYTHONUNBUFFERED=1
9
  ENV DEBIAN_FRONTEND=noninteractive
@@ -20,12 +23,12 @@ ENV HERMES_BIN=/usr/local/bin/hermes
20
 
21
  # ==================== 系统依赖 ====================
22
  RUN apt-get update && apt-get install -y \
23
- build-essential \
24
  ffmpeg \
25
  git \
26
  curl \
27
  unzip \
28
  ca-certificates \
 
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
  # ==================== Node.js v23 ====================
@@ -70,7 +73,7 @@ RUN curl -sL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_a
70
 
71
  # ==================== Python 依赖 ====================
72
  COPY requirements.txt /tmp/
73
- RUN pip install --no-cache-dir -r /tmp/requirements.txt
74
 
75
  # ==================== Hermes Agent ====================
76
  # 克隆并安装 Hermes Agent(不再构建内置 Dashboard 前端,由 hermes-web-ui 替代)
@@ -79,27 +82,24 @@ RUN git clone --depth 1 https://github.com/NousResearch/hermes-agent.git /tmp/he
79
  rm -rf /tmp/hermes-agent /root/.cache/pip
80
 
81
  # Playwright 浏览器(Hermes Agent 工具调用需要)
82
- RUN npx playwright install chromium --with-deps --only-shell
 
83
 
84
  # ==================== Hermes Web UI ====================
85
- # 克隆、构建、精简 hermes-web-ui(单层,避免中间态占用空间)
86
- RUN git clone --depth 1 https://github.com/EKKOLearnAI/hermes-web-ui.git /tmp/hermes-web-ui && \
87
- cd /tmp/hermes-web-ui && \
88
- npm pkg delete scripts.prepare && \
89
- npm install && \
90
- npm run build && \
91
- npm prune --omit=dev && \
92
- mkdir -p /opt/hermes-web-ui && \
93
- cp -r dist node_modules package.json /opt/hermes-web-ui/ && \
94
- rm -rf /tmp/hermes-web-ui /root/.npm
95
 
96
  # ==================== 应用代码 ====================
97
  WORKDIR /app
98
 
99
  COPY src/ /app/src/
100
  COPY entrypoint.sh /app/
101
- COPY image-proxy.js /app/
102
- COPY image-gen-siliconflow.ts /app/
103
  COPY config/config.yaml /data/.hermes/config.yaml
104
 
105
  # 创建数据目录
 
4
  LABEL version="0.10.0"
5
  LABEL description="Hermes Agent v0.10.0 with Web UI on Hugging Face Spaces"
6
 
7
+ # 检测HERMES_WEB_UI最新版本
8
+ ARG HERMES_WEB_UI_VERSION=latest
9
+
10
  # ==================== 环境变量 ====================
11
  ENV PYTHONUNBUFFERED=1
12
  ENV DEBIAN_FRONTEND=noninteractive
 
23
 
24
  # ==================== 系统依赖 ====================
25
  RUN apt-get update && apt-get install -y \
 
26
  ffmpeg \
27
  git \
28
  curl \
29
  unzip \
30
  ca-certificates \
31
+ make gcc g++ \
32
  && rm -rf /var/lib/apt/lists/*
33
 
34
  # ==================== Node.js v23 ====================
 
73
 
74
  # ==================== Python 依赖 ====================
75
  COPY requirements.txt /tmp/
76
+ RUN pip install --no-cache-dir --prefer-binary -r /tmp/requirements.txt
77
 
78
  # ==================== Hermes Agent ====================
79
  # 克隆并安装 Hermes Agent(不再构建内置 Dashboard 前端,由 hermes-web-ui 替代)
 
82
  rm -rf /tmp/hermes-agent /root/.cache/pip
83
 
84
  # Playwright 浏览器(Hermes Agent 工具调用需要)
85
+ RUN npx playwright install chromium --with-deps --only-shell && \
86
+ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
87
 
88
  # ==================== Hermes Web UI ====================
89
+ # 直接安装 npm 发布的预构建包,彻底避免从源码克隆、安装 devDependencies 和编译(节省数分钟及大量 CPU/内存资源)
90
+ # npm 包已包含 dist/(server|client|website) 以及 agent-bridge/hermes_bridge.py
91
+ RUN mkdir -p /opt/hermes-web-ui && cd /opt/hermes-web-ui && \
92
+ npm init -y && \
93
+ npm install hermes-web-ui@${HERMES_WEB_UI_VERSION} --no-audit --no-fund --loglevel=error && \
94
+ ln -sf node_modules/hermes-web-ui/dist dist && \
95
+ ln -sf node_modules/hermes-web-ui/package.json package.json && \
96
+ rm -rf /root/.npm /opt/hermes-web-ui/package-lock.json
 
 
97
 
98
  # ==================== 应用代码 ====================
99
  WORKDIR /app
100
 
101
  COPY src/ /app/src/
102
  COPY entrypoint.sh /app/
 
 
103
  COPY config/config.yaml /data/.hermes/config.yaml
104
 
105
  # 创建数据目录