Spaces:
Sleeping
Sleeping
| # Stage 1: Build the Rust binary | |
| FROM rust:latest AS builder | |
| WORKDIR /app | |
| # Install dependencies required by the 'ort' (ONNX) crate | |
| RUN apt-get update && apt-get install -y cmake clang libssl-dev pkg-config | |
| # Copy your source code | |
| COPY ./Cargo.toml backend/Cargo.toml | |
| COPY ./src backend/src | |
| COPY ./Cargo.lock backend/Cargo.lock | |
| WORKDIR /app/backend | |
| # Build the release binary | |
| RUN cargo build --release | |
| # Stage 2: Create the lightweight runtime image | |
| FROM ubuntu:24.04 | |
| WORKDIR /app | |
| # Install CA certificates (Required for Qdrant Cloud gRPC connection) | |
| RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* | |
| # Copy the compiled binary from the builder stage | |
| COPY --from=builder /app/backend/target/release/verity-backend /app/verity-backend | |
| # COPY THE MODELS INTO THE CONTAINER! | |
| # This replaces the need for volumes. You must upload the 'models' folder to your HF Space. | |
| COPY models /app/models | |
| # Hugging Face Spaces exposes port 7860 by default | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Run the binary | |
| CMD ["/app/verity-backend"] | |