# ── Stage 1: C++ Build ─────────────────────────────────────────────── FROM gcc:13 AS cpp-builder RUN apt-get update && apt-get install -y cmake && rm -rf /var/lib/apt/lists/* WORKDIR /build COPY cpp/ ./cpp/ COPY CMakeLists.txt . RUN cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \ && cmake --build build --target autoforge-dag # ── Stage 2: Python Runtime ───────────────────────────────────────── FROM python:3.12-slim WORKDIR /app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy backend COPY backend/ ./backend/ # Copy frontend COPY frontend/ ./frontend/ # Copy C++ binary from build stage COPY --from=cpp-builder /build/build/cpp/autoforge-dag /app/bin/autoforge-dag # Create data directory RUN mkdir -p /app/data # Environment ENV PYTHONUNBUFFERED=1 ENV DATABASE_URL=sqlite+aiosqlite:///data/autoforge.db EXPOSE 8000 CMD ["python", "-m", "backend.main"]