FROM python:3.11-slim WORKDIR /app # ---- 1. تثبيت أدوات البناء (Rust + حزم C + git) ---- RUN apt-get update && apt-get install -y \ curl \ build-essential \ pkg-config \ libssl-dev \ libgit2-dev \ git \ && rm -rf /var/lib/apt/lists/* # تثبيت Rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # ---- 2. نسخ ملفات المشروع ---- COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY src/ src/ COPY Cargo.toml . COPY app.py . # ---- 3. بناء مكتبة Rust مع maturin ---- RUN pip install maturin RUN cd /app && maturin build --release RUN pip install /app/target/wheels/uspoo_core-*.whl # ---- 4. تشغيل التطبيق ---- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]