Spaces:
Runtime error
Runtime error
| FROM python:3.10-slim | |
| # Fix the environment variable issue at the container level | |
| ENV OMP_NUM_THREADS=1 | |
| ENV MKL_NUM_THREADS=1 | |
| ENV NUMEXPR_NUM_THREADS=1 | |
| ENV OPENBLAS_NUM_THREADS=1 | |
| ENV TRANSFORMERS_CACHE=/tmp/transformers_cache | |
| ENV HF_HOME=/tmp/huggingface_cache | |
| # Create user to fix the getpwuid error | |
| RUN useradd --create-home --uid 1000 --shell /bin/bash user | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create cache directories and set permissions | |
| RUN mkdir -p /tmp/transformers_cache /tmp/huggingface_cache && \ | |
| chown -R user:user /app /tmp/transformers_cache /tmp/huggingface_cache | |
| # Switch to user | |
| USER user | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "app.py"] |