File size: 695 Bytes
9820279
 
fe6976e
9820279
 
 
fe6976e
9820279
 
 
830a73a
9820279
 
830a73a
9820279
 
fe6976e
9820279
 
 
 
 
71575e4
9820279
0bc4572
830a73a
9820279
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
# Stage 1: Build
FROM rust:1.85-bookworm as builder
WORKDIR /app
COPY . .
# Build for release to get all those sweet Rust optimizations
RUN cargo build --release

# Stage 2: Run
FROM debian:bookworm-slim
WORKDIR /app

# Install OpenSSL/CA-certs if your app makes outbound HTTPS calls
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/lists/*

# Copy the binary from the builder stage
COPY --from=builder /app/target/release/rust-hf-app .

# Create a non-root user for Hugging Face security compliance
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Expose the default HF Spaces port
EXPOSE 7860

CMD ["./rust-hf-app"]