Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +19 -16
Dockerfile
CHANGED
|
@@ -45,20 +45,20 @@ RUN uv pip install --python /opt/hermes/.venv/bin/python --no-cache-dir \
|
|
| 45 |
&& chmod 0440 /etc/sudoers.d/hermes \
|
| 46 |
&& /usr/sbin/visudo -cf /etc/sudoers.d/hermes
|
| 47 |
|
| 48 |
-
# 3. 复制魔改项目的全部核心组件
|
| 49 |
-
COPY
|
| 50 |
-
COPY
|
| 51 |
-
COPY
|
| 52 |
-
COPY
|
| 53 |
-
COPY
|
| 54 |
-
COPY
|
| 55 |
-
|
| 56 |
-
# CRITICAL FIX:
|
|
|
|
|
|
|
| 57 |
RUN sed -i 's/\r$//' /opt/huggingmes/start.sh && \
|
| 58 |
-
chmod
|
| 59 |
-
/opt/
|
| 60 |
-
/opt/huggingmes/cloudflare-proxy-setup.py \
|
| 61 |
-
/opt/huggingmes/cloudflare-keepalive-setup.py
|
| 62 |
|
| 63 |
# 4. 保留原项目看板数据库迁移幂等补丁
|
| 64 |
RUN python3 - <<'PY'
|
|
@@ -107,7 +107,10 @@ PY
|
|
| 107 |
RUN echo 'export PATH="/opt/hermes/.venv/bin:/opt/data/.local/bin:$PATH"' \
|
| 108 |
> /etc/profile.d/hermes-venv.sh
|
| 109 |
|
| 110 |
-
#
|
|
|
|
|
|
|
|
|
|
| 111 |
ENV HERMES_HOME=/opt/data \
|
| 112 |
HUGGINGMES_APP_DIR=/opt/huggingmes \
|
| 113 |
HERMES_AGENT_VERSION=${HERMES_AGENT_VERSION} \
|
|
@@ -120,5 +123,5 @@ EXPOSE 7861
|
|
| 120 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \
|
| 121 |
CMD curl -fsS http://localhost:7861/health || exit 1
|
| 122 |
|
| 123 |
-
#
|
| 124 |
-
CMD ["/
|
|
|
|
| 45 |
&& chmod 0440 /etc/sudoers.d/hermes \
|
| 46 |
&& /usr/sbin/visudo -cf /etc/sudoers.d/hermes
|
| 47 |
|
| 48 |
+
# 3. 复制魔改项目的全部核心组件
|
| 49 |
+
COPY start.sh /opt/huggingmes/start.sh
|
| 50 |
+
COPY health-server.js /opt/huggingmes/health-server.js
|
| 51 |
+
COPY cloudflare-proxy-setup.py /opt/huggingmes/cloudflare-proxy-setup.py
|
| 52 |
+
COPY cloudflare-keepalive-setup.py /opt/huggingmes/cloudflare-keepalive-setup.py
|
| 53 |
+
COPY env-builder.html /opt/huggingmes/env-builder.html
|
| 54 |
+
COPY env-builder.js /opt/huggingmes/env-builder.js
|
| 55 |
+
|
| 56 |
+
# CRITICAL ROOTLESS FIX:
|
| 57 |
+
# 1. 强力抹除 Windows 换行符。
|
| 58 |
+
# 2. 对整个工作空间刷成 777,确保在任何低权限随机 UID 下进程都有完全的绝对读写和执行权。
|
| 59 |
RUN sed -i 's/\r$//' /opt/huggingmes/start.sh && \
|
| 60 |
+
chmod -R 777 /opt/huggingmes && \
|
| 61 |
+
mkdir -p /opt/data && chmod -R 777 /opt/data
|
|
|
|
|
|
|
| 62 |
|
| 63 |
# 4. 保留原项目看板数据库迁移幂等补丁
|
| 64 |
RUN python3 - <<'PY'
|
|
|
|
| 107 |
RUN echo 'export PATH="/opt/hermes/.venv/bin:/opt/data/.local/bin:$PATH"' \
|
| 108 |
> /etc/profile.d/hermes-venv.sh
|
| 109 |
|
| 110 |
+
# 恢复官方默认的普通用户身份,顺应底层容器集群的沙箱降权安全策略
|
| 111 |
+
USER hermes
|
| 112 |
+
|
| 113 |
+
# 恢复官方底座的标准环境变量
|
| 114 |
ENV HERMES_HOME=/opt/data \
|
| 115 |
HUGGINGMES_APP_DIR=/opt/huggingmes \
|
| 116 |
HERMES_AGENT_VERSION=${HERMES_AGENT_VERSION} \
|
|
|
|
| 123 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \
|
| 124 |
CMD curl -fsS http://localhost:7861/health || exit 1
|
| 125 |
|
| 126 |
+
# 顺应官方底座的启动入口,将我们的 start.sh 挂载为业务服务的主入口
|
| 127 |
+
CMD ["/opt/huggingmes/start.sh"]
|