File size: 1,060 Bytes
683a8cb
86e87f9
683a8cb
 
 
 
 
 
 
86e87f9
 
 
683a8cb
 
 
 
 
 
 
86e87f9
683a8cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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"]