Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +22 -42
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
# Marimo Zero - Agent Zero + Marimo + OmniRoute
|
| 2 |
-
#
|
| 3 |
|
| 4 |
-
FROM
|
| 5 |
|
| 6 |
USER root
|
| 7 |
|
|
@@ -33,6 +33,7 @@ echo "π Starting Marimo Zero..."
|
|
| 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,59 +44,29 @@ ACCOUNTS
|
|
| 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
|
| 52 |
echo "π Starting proxy..."
|
| 53 |
python3 << 'PROXY'
|
| 54 |
from fastapi import FastAPI, Request
|
| 55 |
-
from fastapi.responses import StreamingResponse
|
| 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"
|
| 99 |
|
| 100 |
@app.get("/marimo")
|
| 101 |
async def marimo_redir():
|
|
@@ -111,13 +82,22 @@ async def marimo_proxy(request: Request, path: str):
|
|
| 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 "
|
| 121 |
echo " Marimo: http://localhost:7860/marimo/"
|
| 122 |
wait
|
| 123 |
EOF
|
|
|
|
| 1 |
+
# Marimo Zero - Official Agent Zero + Marimo + OmniRoute
|
| 2 |
+
# Uses frdel/agent-zero-exe base image
|
| 3 |
|
| 4 |
+
FROM frdel/agent-zero-exe:latest
|
| 5 |
|
| 6 |
USER root
|
| 7 |
|
|
|
|
| 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 |
+
export ANTHROPIC_API_KEY=$(echo $API_KEYS_JSON | jq -r '.anthropic // empty')
|
| 37 |
fi
|
| 38 |
|
| 39 |
# Start OmniRoute
|
|
|
|
| 44 |
omniroute start --port 20128 --accounts /app/.omniroute/accounts.json &
|
| 45 |
sleep 2
|
| 46 |
|
| 47 |
+
# Start Agent Zero Web UI
|
| 48 |
+
echo "π€ Starting Agent Zero Web UI..."
|
| 49 |
+
cd /app && python3 run_ui.py &
|
| 50 |
+
sleep 5
|
| 51 |
+
|
| 52 |
# Start Marimo
|
| 53 |
echo "π Starting Marimo..."
|
| 54 |
marimo run /app/marimo/marimo_sandbox.py --host 0.0.0.0 --port 8081 --headless &
|
| 55 |
sleep 3
|
| 56 |
|
| 57 |
+
# Start proxy
|
| 58 |
echo "π Starting proxy..."
|
| 59 |
python3 << 'PROXY'
|
| 60 |
from fastapi import FastAPI, Request
|
| 61 |
+
from fastapi.responses import StreamingResponse
|
|
|
|
| 62 |
import httpx
|
|
|
|
| 63 |
|
| 64 |
app = FastAPI()
|
| 65 |
client = httpx.AsyncClient(timeout=120.0)
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
@app.get("/health")
|
| 68 |
async def health():
|
| 69 |
+
return {"status": "healthy"}
|
| 70 |
|
| 71 |
@app.get("/marimo")
|
| 72 |
async def marimo_redir():
|
|
|
|
| 82 |
r = await client.request(request.method, url, headers=h, content=b)
|
| 83 |
return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
|
| 84 |
|
| 85 |
+
@app.api_route("/{path:path}", methods=["GET","POST","PUT","DELETE","PATCH"])
|
| 86 |
+
async def az_proxy(request: Request, path: str):
|
| 87 |
+
url = f"http://localhost:80/{path}" if path else "http://localhost:80"
|
| 88 |
+
h = dict(request.headers)
|
| 89 |
+
h.pop("host", None)
|
| 90 |
+
b = await request.body() if request.method in ["POST","PUT","PATCH"] else None
|
| 91 |
+
r = await client.request(request.method, url, headers=h, content=b)
|
| 92 |
+
return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
|
| 93 |
+
|
| 94 |
if __name__ == "__main__":
|
| 95 |
import uvicorn
|
| 96 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 97 |
PROXY
|
| 98 |
|
| 99 |
echo "β
Ready!"
|
| 100 |
+
echo " Agent Zero: http://localhost:7860"
|
| 101 |
echo " Marimo: http://localhost:7860/marimo/"
|
| 102 |
wait
|
| 103 |
EOF
|