New.space / Dockerfile
Cryptostoner's picture
Deploy verified Autonomous Revenue Agent V2 Docker build
18535e8 verified
Raw History Blame Contribute Delete
2.96 kB
# =============================================================================
# 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"]