| FROM rust:1.80-slim-bookworm as builder | |
| WORKDIR /app | |
| # Install necessary build tools | |
| RUN apt-get update && apt-get install -y pkg-config libssl-dev cmake | |
| # Copy the entire workspace | |
| COPY . . | |
| # Build the CLI crate in release mode | |
| RUN cargo build --release | |
| # Production image | |
| FROM debian:bookworm-slim | |
| WORKDIR /app | |
| # Install run-time dependencies | |
| RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/* | |
| # Install fastapi and uvicorn for the proxy server | |
| RUN pip3 install --no-cache-dir fastapi uvicorn[standard] pydantic requests --break-system-packages | |
| # Copy the compiled firm binary | |
| COPY --from=builder /app/target/release/firm /usr/local/bin/firm | |
| # Copy the example workspace to use as data | |
| COPY --from=builder /app/example /app/workspace | |
| # Copy the server python file | |
| COPY app.py /app/app.py | |
| COPY firmskill.md /app/firmskill.md | |
| EXPOSE 7860 | |
| # Run the python app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |