# Dockerfile FROM python:3.9-slim # Install dependencies RUN apt-get update && apt-get install -y git git-lfs && git lfs install # Set environment variables ENV HF_HOME="/home/appuser/.cache/huggingface" ENV TRANSFORMERS_CACHE="/home/appuser/.cache/huggingface/transformers" ENV HF_DATASETS_CACHE="/home/appuser/.cache/huggingface/datasets" # Create a non-root user RUN useradd -ms /bin/bash appuser # Set the working directory WORKDIR /home/appuser/app # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY . . # Change ownership RUN chown -R appuser:appuser /home/appuser # Switch to non-root user USER appuser # Expose the port EXPOSE 7860 # Command to run the application CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]