TheEdict commited on
Commit
fd6b4e6
Β·
verified Β·
1 Parent(s): 845741d

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -40
Dockerfile CHANGED
@@ -1,4 +1,5 @@
1
  # Marimo Zero - Agent Zero + Marimo + OmniRoute
 
2
 
3
  FROM agent0ai/agent-zero:latest
4
 
@@ -21,7 +22,7 @@ RUN mkdir -p /app/marimo /app/workspace /app/.omniroute && chmod -R 777 /app
21
  # 4. Copy Marimo notebook
22
  COPY marimo_sandbox.py /app/marimo/marimo_sandbox.py
23
 
24
- # 5. Create startup script that ALSO starts base image services
25
  RUN cat > /app/start.sh << 'EOF'
26
  #!/bin/bash
27
  set -e
@@ -32,7 +33,6 @@ echo "πŸš€ Starting Marimo Zero..."
32
  if [ -n "$API_KEYS_JSON" ]; then
33
  echo "πŸ“ Loading API keys..."
34
  export OPENAI_API_KEY=$(echo $API_KEYS_JSON | jq -r '.openai // empty')
35
- export ANTHROPIC_API_KEY=$(echo $API_KEYS_JSON | jq -r '.anthropic // empty')
36
  fi
37
 
38
  # Start OmniRoute
@@ -43,50 +43,59 @@ ACCOUNTS
43
  omniroute start --port 20128 --accounts /app/.omniroute/accounts.json &
44
  sleep 2
45
 
46
- # Start Agent Zero services from base image
47
- # The base image typically runs a Node.js web UI and Python backend
48
- echo "πŸ€– Starting Agent Zero services..."
49
-
50
- # Check for and run the base image entrypoint
51
- if [ -f /entrypoint.sh ]; then
52
- echo "Running base entrypoint..."
53
- /entrypoint.sh &
54
- sleep 5
55
- elif [ -f /app/run.py ]; then
56
- echo "Running run.py..."
57
- python3 /app/run.py &
58
- sleep 5
59
- elif [ -f /app/run_ui.py ]; then
60
- echo "Running run_ui.py..."
61
- python3 /app/run_ui.py &
62
- sleep 5
63
- elif command -v node &> /dev/null && [ -f /app/server.js ]; then
64
- echo "Running Node.js server..."
65
- node /app/server.js &
66
- sleep 5
67
- else
68
- echo "Looking for Agent Zero services..."
69
- find / -name "run*.py" -o -name "server.js" -o -name "main.py" 2>/dev/null | head -5
70
- fi
71
-
72
  # Start Marimo
73
  echo "πŸ““ Starting Marimo..."
74
  marimo run /app/marimo/marimo_sandbox.py --host 0.0.0.0 --port 8081 --headless &
75
  sleep 3
76
 
77
- # Start proxy
78
  echo "πŸ”€ Starting proxy..."
79
  python3 << 'PROXY'
80
  from fastapi import FastAPI, Request
81
- from fastapi.responses import StreamingResponse
 
82
  import httpx
 
83
 
84
  app = FastAPI()
85
  client = httpx.AsyncClient(timeout=120.0)
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  @app.get("/health")
88
  async def health():
89
- return {"status": "healthy"}
90
 
91
  @app.get("/marimo")
92
  async def marimo_redir():
@@ -102,21 +111,14 @@ async def marimo_proxy(request: Request, path: str):
102
  r = await client.request(request.method, url, headers=h, content=b)
103
  return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
104
 
105
- @app.api_route("/{path:path}", methods=["GET","POST","PUT","DELETE","PATCH"])
106
- async def az_proxy(request: Request, path: str):
107
- url = f"http://localhost:80/{path}" if path else "http://localhost:80"
108
- h = dict(request.headers)
109
- h.pop("host", None)
110
- b = await request.body() if request.method in ["POST","PUT","PATCH"] else None
111
- r = await client.request(request.method, url, headers=h, content=b)
112
- return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
113
-
114
  if __name__ == "__main__":
115
  import uvicorn
116
  uvicorn.run(app, host="0.0.0.0", port=7860)
117
  PROXY
118
 
119
  echo "βœ… Ready!"
 
 
120
  wait
121
  EOF
122
 
 
1
  # Marimo Zero - Agent Zero + Marimo + OmniRoute
2
+ # Simplified: Just run Agent Zero's web server directly
3
 
4
  FROM agent0ai/agent-zero:latest
5
 
 
22
  # 4. Copy Marimo notebook
23
  COPY marimo_sandbox.py /app/marimo/marimo_sandbox.py
24
 
25
+ # 5. Create startup script
26
  RUN cat > /app/start.sh << 'EOF'
27
  #!/bin/bash
28
  set -e
 
33
  if [ -n "$API_KEYS_JSON" ]; then
34
  echo "πŸ“ Loading API keys..."
35
  export OPENAI_API_KEY=$(echo $API_KEYS_JSON | jq -r '.openai // empty')
 
36
  fi
37
 
38
  # Start OmniRoute
 
43
  omniroute start --port 20128 --accounts /app/.omniroute/accounts.json &
44
  sleep 2
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  # Start Marimo
47
  echo "πŸ““ Starting Marimo..."
48
  marimo run /app/marimo/marimo_sandbox.py --host 0.0.0.0 --port 8081 --headless &
49
  sleep 3
50
 
51
+ # Start proxy - directly serve Agent Zero static files or proxy
52
  echo "πŸ”€ Starting proxy..."
53
  python3 << 'PROXY'
54
  from fastapi import FastAPI, Request
55
+ from fastapi.responses import StreamingResponse, HTMLResponse
56
+ from fastapi.staticfiles import StaticFiles
57
  import httpx
58
+ import os
59
 
60
  app = FastAPI()
61
  client = httpx.AsyncClient(timeout=120.0)
62
 
63
+ # Try to find and mount Agent Zero web UI
64
+ AGENT_ZERO_WEB_PATHS = [
65
+ "/opt/venv-a0/lib/python3.12/site-packages/agent_zero/web",
66
+ "/app/web",
67
+ "/usr/share/agent-zero/web",
68
+ "/var/www/agent-zero",
69
+ ]
70
+
71
+ web_path = None
72
+ for path in AGENT_ZERO_WEB_PATHS:
73
+ if os.path.exists(path):
74
+ web_path = path
75
+ break
76
+
77
+ if web_path:
78
+ print(f"Serving Agent Zero web UI from: {web_path}")
79
+ app.mount("/", StaticFiles(directory=web_path, html=True), name="agent_zero")
80
+ else:
81
+ print("Agent Zero web UI not found, serving simple page")
82
+
83
+ @app.get("/")
84
+ async def root():
85
+ return HTMLResponse("""
86
+ <html>
87
+ <head><title>Marimo Zero</title></head>
88
+ <body>
89
+ <h1>πŸ¦€ Marimo Zero</h1>
90
+ <p>Agent Zero web UI not found in base image.</p>
91
+ <p><a href="/marimo/">Open Marimo Sandbox</a></p>
92
+ </body>
93
+ </html>
94
+ """)
95
+
96
  @app.get("/health")
97
  async def health():
98
+ return {"status": "healthy", "web_path": web_path}
99
 
100
  @app.get("/marimo")
101
  async def marimo_redir():
 
111
  r = await client.request(request.method, url, headers=h, content=b)
112
  return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
113
 
 
 
 
 
 
 
 
 
 
114
  if __name__ == "__main__":
115
  import uvicorn
116
  uvicorn.run(app, host="0.0.0.0", port=7860)
117
  PROXY
118
 
119
  echo "βœ… Ready!"
120
+ echo " Main: http://localhost:7860"
121
+ echo " Marimo: http://localhost:7860/marimo/"
122
  wait
123
  EOF
124