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 (app.py, requirements.txt, sample_rust/) 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 # Run your Flask app CMD ["python3", "app.py"]