dieumercimvemba commited on
Commit
64ff49b
·
verified ·
1 Parent(s): edaa402

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +77 -33
Dockerfile CHANGED
@@ -1,53 +1,97 @@
1
  FROM nousresearch/hermes-agent:latest
2
 
3
- # 1. Installation de Node.js et npm
4
  USER root
 
 
5
  RUN apt-get update && \
6
- apt-get install -y nodejs npm ffmpeg && \
7
  rm -rf /var/lib/apt/lists/*
8
 
9
- # 2. Préparation du répertoire de données
10
- RUN mkdir -p /opt/data/logs && chmod -R 777 /opt/data
11
-
12
- # 3. Script d'initialisation au boot
13
  RUN mkdir -p /etc/cont-init.d && \
14
- cat << 'EOF' > /etc/cont-init.d/99-fix-perms.sh
15
  #!/bin/sh
16
- rm -f /opt/data/*.lock /opt/data/*.db.init.lock
17
  mkdir -p /opt/data/logs
18
- chown -hR 10000:10000 /opt/data 2>/dev/null || true
19
- chmod -R 777 /opt/data 2>/dev/null || true
20
  EOF
21
- RUN chmod +x /etc/cont-init.d/99-fix-perms.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- # 4. Configuration Gateway & API Server (Port 7860 pour Hugging Face)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  ENV HERMES_HOME=/opt/data \
25
  HOME=/opt/data \
26
  API_SERVER_ENABLED=true \
27
- API_SERVER_HOST=0.0.0.0 \
28
  API_SERVER_PORT=8642 \
29
  HERMES_DASHBOARD=1 \
30
- HERMES_DASHBOARD_HOST=0.0.0.0 \
31
- HERMES_DASHBOARD_PORT=7860 \
 
 
32
 
33
- API_SERVER_KEY=hermes_2026_8QvL9mN2XpR7kTw5YcH4ZaU1EfD8JsP6BgW3NrKyLxV9
34
-
35
- # 5. Activation des messageries
36
- ENV TELEGRAM_ENABLED=true \
37
- WHATSAPP_ENABLED=false \
38
- DISCORD_ENABLED=false \
39
- SLACK_ENABLED=false \
40
- MATRIX_ENABLED=false
41
-
42
- # 6. Sécurité et comportement
43
- ENV HERMES_TOOL_LOOP_HARD_STOP_ENABLED=true \
44
- HERMES_TOOL_LOOP_EXACT_FAILURE_LIMIT=5 \
45
- HERMES_TOOL_LOOP_IDEMPOTENT_LIMIT=5 \
46
- HERMES_LOG_LEVEL=INFO
47
-
48
- EXPOSE 7860 8642
49
 
50
  WORKDIR /opt/data
51
 
52
- CMD ["gateway", "run"]
53
-
 
1
  FROM nousresearch/hermes-agent:latest
2
 
 
3
  USER root
4
+
5
+ # 1. Installation des dépendances
6
  RUN apt-get update && \
7
+ apt-get install -y nginx nodejs npm ffmpeg && \
8
  rm -rf /var/lib/apt/lists/*
9
 
10
+ # 2. Correction stricte des permissions (s'exécute au boot)
 
 
 
11
  RUN mkdir -p /etc/cont-init.d && \
12
+ cat << 'EOF' > /etc/cont-init.d/00-fix-logs
13
  #!/bin/sh
14
+ echo "=== Création et application des droits pour l'utilisateur 10000 (Hermes) ==="
15
  mkdir -p /opt/data/logs
16
+ chown -R 10000:10000 /opt/data
17
+ chmod -R 777 /opt/data
18
  EOF
19
+ RUN chmod +x /etc/cont-init.d/00-fix-logs
20
+
21
+ # 3. Configuration Nginx (Reverse Proxy)
22
+ RUN cat << 'EOF' > /etc/nginx/nginx.conf
23
+ worker_processes auto;
24
+ pid /tmp/nginx.pid;
25
+ error_log /tmp/error.log warn;
26
+
27
+ events {
28
+ worker_connections 1024;
29
+ }
30
+
31
+ http {
32
+ include /etc/nginx/mime.types;
33
+ default_type application/octet-stream;
34
+
35
+ client_body_temp_path /tmp/client_body;
36
+ proxy_temp_path /tmp/proxy;
37
+ fastcgi_temp_path /tmp/fastcgi;
38
+ uwsgi_temp_path /tmp/uwsgi;
39
+ scgi_temp_path /tmp/scgi;
40
+ access_log /tmp/access.log;
41
 
42
+ server {
43
+ listen 7860;
44
+ server_name _;
45
+
46
+ location /v1/ {
47
+ proxy_pass http://127.0.0.1:8642;
48
+ proxy_http_version 1.1;
49
+ proxy_set_header Upgrade $http_upgrade;
50
+ proxy_set_header Connection "upgrade";
51
+ proxy_set_header Host $host;
52
+ }
53
+
54
+ location /webhook/ {
55
+ proxy_pass http://127.0.0.1:8642;
56
+ proxy_http_version 1.1;
57
+ proxy_set_header Host $host;
58
+ }
59
+
60
+ location / {
61
+ proxy_pass http://127.0.0.1:9119;
62
+ proxy_http_version 1.1;
63
+ proxy_set_header Upgrade $http_upgrade;
64
+ proxy_set_header Connection "upgrade";
65
+ proxy_set_header Host $host;
66
+ }
67
+ }
68
+ }
69
+ EOF
70
+
71
+ # 4. Ajout de Nginx comme service natif (Démarrera en même temps qu'Hermes)
72
+ RUN mkdir -p /etc/services.d/nginx && \
73
+ cat << 'EOF' > /etc/services.d/nginx/run
74
+ #!/bin/sh
75
+ mkdir -p /tmp/client_body /tmp/proxy /tmp/fastcgi /tmp/uwsgi /tmp/scgi
76
+ exec nginx -g "daemon off;"
77
+ EOF
78
+ RUN chmod +x /etc/services.d/nginx/run
79
+
80
+ # 5. Variables d'environnement
81
  ENV HERMES_HOME=/opt/data \
82
  HOME=/opt/data \
83
  API_SERVER_ENABLED=true \
84
+ API_SERVER_HOST=127.0.0.1 \
85
  API_SERVER_PORT=8642 \
86
  HERMES_DASHBOARD=1 \
87
+ HERMES_DASHBOARD_HOST=127.0.0.1 \
88
+ HERMES_DASHBOARD_PORT=9119 \
89
+ API_SERVER_KEY=hermes_2026_8QvL9mN2XpR7kTw5YcH4ZaU1EfD8JsP6BgW3NrKyLxV9 \
90
+ TELEGRAM_ENABLED=true
91
 
92
+ EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  WORKDIR /opt/data
95
 
96
+ # IMPORTANT : AUCUN CMD NI ENTRYPOINT ICI.
97
+ # On laisse l'image de base gérer le démarrage de s6-overlay qui lancera Hermes ET Nginx.