Spaces:
Sleeping
Sleeping
| # Use Python 3.9 slim image as base | |
| FROM python:3.9-slim | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy requirements and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install -r requirements.txt | |
| # Create cache directories with proper permissions | |
| RUN mkdir -p /tmp/huggingface \ | |
| && mkdir -p /tmp/transformers \ | |
| && mkdir -p /tmp/sentence-transformers \ | |
| && mkdir -p /tmp/matplotlib \ | |
| && chmod 777 /tmp/huggingface \ | |
| && chmod 777 /tmp/transformers \ | |
| && chmod 777 /tmp/sentence-transformers \ | |
| && chmod 777 /tmp/matplotlib | |
| # Copy application code | |
| COPY . . | |
| # Set environment variables | |
| ENV HF_HOME=/tmp/huggingface | |
| ENV TRANSFORMERS_CACHE=/tmp/transformers | |
| ENV SENTENCE_TRANSFORMERS_HOME=/tmp/sentence-transformers | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| ENV TF_ENABLE_ONEDNN_OPTS=0 | |
| # Preload models during build | |
| RUN python -c "from services.api.chatbot.model_init import embedding_model" | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["uvicorn", "services.api.db.auth:app", "--host", "0.0.0.0", "--port", "7860"] |