File size: 2,964 Bytes
18535e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# =============================================================================
# Super Agent OS V2 — Hugging Face Docker Space (CPU Basic compatible)
# =============================================================================
# Stage 1: Build the React frontend (Vite + TypeScript)
# Stage 2: Python runtime with FastAPI serving API + built SPA
# Hugging Face Docker Spaces expect the web service on port 7860.
# =============================================================================

FROM node:20-slim AS frontend-builder

WORKDIR /build/dashboard

COPY artifacts/bounty-dashboard/package.json artifacts/bounty-dashboard/package-lock.json* ./
RUN npm ci --no-audit --no-fund 2>/dev/null || npm install --no-audit --no-fund

COPY artifacts/bounty-dashboard/ ./
RUN npm run build

FROM python:3.11-slim-bookworm AS runtime

LABEL org.opencontainers.image.title="Super Agent OS V2"
LABEL org.opencontainers.image.description="Autonomous multi-agent platform for Hugging Face Docker Spaces"
LABEL org.opencontainers.image.source="https://github.com/cryptostoner94/Autonomous-Revenue-Agent-V2"
LABEL org.opencontainers.image.licenses="MIT"

RUN (apt-get update --allow-releaseinfo-change 2>/dev/null || true) && \
    (apt-get install -y --no-install-recommends gcc g++ libffi-dev libssl-dev 2>/dev/null || true) && \
    rm -rf /var/lib/apt/lists/* 2>/dev/null || true

RUN useradd -m -u 1000 user
WORKDIR /app

COPY artifacts/bounty-agent/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir --prefer-binary -r requirements.txt

COPY --chown=user:user artifacts/bounty-agent/ ./
COPY --from=frontend-builder --chown=user:user /build/dashboard/dist/public/ ./bounty-dashboard/dist/public/

RUN mkdir -p /app/runtime /app/runtime/auth_sessions /app/runtime/submissions /app/reports && \
    chown -R user:user /app

USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PORT=7860 \
    DATABASE_URL="sqlite:////app/runtime/super_agent_os.db" \
    V2_STATE_DIR="/app/runtime" \
    V2_AUTH_SESSION_DIR="/app/runtime/auth_sessions" \
    V2_SUBMISSION_QUEUE_DIR="/app/runtime/submissions" \
    ENABLE_V2_CRUISE_CONTROL="true" \
    V2_EXECUTION_MODE="auto_submission_enabled" \
    V2_TICK_SECONDS="86400" \
    PUBLIC_BASE_URL="http://localhost:7860" \
    BASE_MAINNET_RPC="https://mainnet.base.org" \
    BASE_CHAIN_ID="8453" \
    COW_API_BASE_URL="https://api.cow.fi/base/api/v1" \
    X402_SERVICE_PRICE_USDC="0.05" \
    DASHBOARD_STATIC_DIR="/app/bounty-dashboard/dist/public"

EXPOSE 7860

HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=3 \
    CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/api/v2/status', timeout=5)" || exit 1

CMD ["uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--no-access-log"]