Spaces:
Sleeping
Sleeping
Upload Dockerfile with huggingface_hub
Browse files1234516 unmodified lines22232424252627284 unmodified lines333435353637384 unmodified lines43444546474849505152535455565758596061626364656667686970714647484950775152535481555657585960616263646566676869707172737475767778798081828384858687888990919293949596978998991001019 unmodified lines111112113105106107108109110111112113114115116117118119120121122123124# Marimo Zero - Agent Zero + Marimo + OmniRoute# Simplified: Just run Agent Zero's web server directly
FROM agent0ai/agent-zero:latest
16 unmodified lines# 4. Copy Marimo notebookCOPY marimo_sandbox.py /app/marimo/marimo_sandbox.py
# 5. Create startup script that ALSO starts base image services# 5. Create startup scriptRUN cat > /app/start.sh << 'EOF'#!/bin/bashset -e4 unmodified linesif [ -n "$API_KEYS_JSON" ]; then echo "π Loading API keys..." export OPENAI_API_KEY=$(echo $API_KEYS_JSON | jq -r '.openai // empty') export ANTHROPIC_API_KEY=$(echo $API_KEYS_JSON | jq -r '.anthropic // empty')fi
# Start OmniRoute4 unmodified linesomniroute start --port 20128 --accounts /app/.omniroute/accounts.json &sleep 2
# Start Agent Zero services from base image# The base image typically runs a Node.js web UI and Python backendecho "π€ Starting Agent Zero services..."
# Check for and run the base image entrypointif [ -f /entrypoint.sh ]; then echo "Running base entrypoint..." /entrypoint.sh & sleep 5elif [ -f /app/run.py ]; then echo "Running run.py..." python3 /app/run.py & sleep 5elif [ -f /app/run_ui.py ]; then echo "Running run_ui.py..." python3 /app/run_ui.py & sleep 5elif command -v node &> /dev/null && [ -f /app/server.js ]; then echo "Running Node.js server..." node /app/server.js & sleep 5else echo "Looking for Agent Zero services..." find / -name "run*.py" -o -name "server.js" -o -name "main.py" 2>/dev/null | head -5fi
# Start Marimoecho "π Starting Marimo..."marimo run /app/marimo/marimo_sandbox.py --host 0.0.0.0 --port 8081 --headless &sleep 3
# Start proxy# Start proxy - directly serve Agent Zero static files or proxyecho "π Starting proxy..."python3 << 'PROXY'from fastapi import FastAPI, Requestfrom fastapi.responses import StreamingResponsefrom fastapi.responses import StreamingResponse, HTMLResponsefrom fastapi.staticfiles import StaticFilesimport httpximport os
app = FastAPI()client = httpx.AsyncClient(timeout=120.0)
# Try to find and mount Agent Zero web UIAGENT_ZERO_WEB_PATHS = [ "/opt/venv-a0/lib/python3.12/site-packages/agent_zero/web", "/app/web", "/usr/share/agent-zero/web", "/var/www/agent-zero",]
web_path = Nonefor path in AGENT_ZERO_WEB_PATHS: if os.path.exists(path): web_path = path break
if web_path: print(f"Serving Agent Zero web UI from: {web_path}") app.mount("/", StaticFiles(directory=web_path, html=True), name="agent_zero")else: print("Agent Zero web UI not found, serving simple page") @app.get("/") async def root(): return HTMLResponse(""" <html> <head><title>Marimo Zero</title></head> <body> <h1>π¦ Marimo Zero</h1> <p>Agent Zero web UI not found in base image.</p> <p><a href="/marimo/">Open Marimo Sandbox</a></p> </body> </html> """)
@app.get("/health")async def health(): return {"status": "healthy"} return {"status": "healthy", "web_path": web_path}
@app.get("/marimo")async def marimo_redir():9 unmodified lines r = await client.request(request.method, url, headers=h, content=b) return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
@app.api_route("/{path:path}", methods=["GET","POST","PUT","DELETE","PATCH"])async def az_proxy(request: Request, path: str): url = f"http://localhost:80/{path}" if path else "http://localhost:80" h = dict(request.headers) h.pop("host", None) b = await request.body() if request.method in ["POST","PUT","PATCH"] else None r = await client.request(request.method, url, headers=h, content=b) return StreamingResponse(r.aiter_bytes(), status_code=r.status_code, headers=dict(r.headers))
if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=7860)PROXY
echo "β
Ready!"echo " Main: http://localhost:7860"echo " Marimo: http://localhost:7860/marimo/"waitEOF
Dockerfile+42-40