# Build stage
FROM rust:1.80-bookworm AS builder
WORKDIR /usr/src/claw-code
COPY claw-code /usr/src/claw-code
RUN cargo build --release

# Runner stage
FROM python:3.12-slim
WORKDIR /app
COPY --from=builder /usr/src/claw-code/target/release/claw /app/claw
COPY server.py /app/server.py

# Install dependencies for fastapi server and for executing test scripts (numpy, pymdp)
RUN pip install --no-cache-dir fastapi uvicorn pydantic numpy pymdp

EXPOSE 9000
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "9000"]
