FROM python:3.9-slim ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV PIP_NO_CACHE_DIR=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1 ENV HF_HOME=/code/huggingface_cache ENV TRANSFORMERS_CACHE=/code/huggingface_cache/transformers ENV HF_DATASETS_CACHE=/code/huggingface_cache/datasets ENV TORCH_HOME=/code/torch_cache ENV TOKENIZERS_PARALLELISM=false ENV OMP_NUM_THREADS=1 ENV MKL_NUM_THREADS=1 ENV OPENBLAS_NUM_THREADS=1 RUN apt-get update && apt-get install -y \ ffmpeg \ libavcodec-extra \ espeak-ng \ alsa-utils \ libasound2-dev \ libsndfile1 \ cmake \ build-essential \ pkg-config \ gcc \ g++ \ curl \ wget \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /code RUN mkdir -p $HF_HOME $TORCH_HOME COPY requirements.txt /code/requirements.txt # Installation simple et directe basée uniquement sur votre requirements.txt propre RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ pip install --no-cache-dir -r /code/requirements.txt && \ rm -rf ~/.cache/pip COPY . /code/ RUN useradd --create-home --shell /bin/bash app && \ chown -R app:app /code USER app HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 EXPOSE 7860 CMD ["python", "-u", "app.py"]