FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libgomp1 \ build-essential \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir --timeout=1000 -r /app/requirements.txt COPY . /app RUN useradd -m -u 1000 appuser && \ mkdir -p /app/sources/custom_quiz /app/faiss_storage_custom_quiz \ /tmp/transformers_cache /tmp/hf_home /tmp/torch_home && \ chown -R appuser:appuser /app /tmp/transformers_cache /tmp/hf_home /tmp/torch_home USER appuser ENV PORT=7861 \ TRANSFORMERS_CACHE=/tmp/transformers_cache \ HF_HOME=/tmp/hf_home \ TORCH_HOME=/tmp/torch_home EXPOSE 7861 CMD ["gunicorn", "--bind", "0.0.0.0:7861", "--workers", "1", "--threads", "8", "--timeout", "180", "--access-logfile", "-", "--error-logfile", "-", "custom_quiz_app:app"]