File size: 757 Bytes
14d2767
 
68430bf
 
18521ae
 
 
 
 
14d2767
 
68430bf
 
14d2767
18521ae
 
997e5d9
e5b847a
18521ae
68a45ea
f8692ea
 
 
 
68a45ea
68430bf
f8692ea
18521ae
14d2767
e5b847a
 
 
 
e3b7539
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
FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    curl build-essential python3-dev \
 && rm -rf /var/lib/apt/lists/*

# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Install maturin
RUN pip install maturin

# Set working directory
WORKDIR /app

# Copy your project files (including app.py and requirements.txt)
COPY . .

# Install Python dependencies
RUN pip install -r requirements.txt

# Build Rust extension
RUN maturin build --release --manifest-path sample_rust/Cargo.toml

# Install the generated wheel
RUN pip install sample_rust/target/wheels/*.whl

# Expose port Hugging Face uses
EXPOSE 7860

# Start the Flask app
CMD ["python3", "app.py"]