Spaces:
Runtime error
Runtime error
| FROM python:3.9 | |
| # Create a user and switch to it | |
| RUN useradd -ms /bin/bash appuser | |
| # Set working directory | |
| WORKDIR /app | |
| # Install required Python packages | |
| COPY ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy application code | |
| COPY app/ app/ | |
| # Create necessary directories and adjust ownership | |
| RUN mkdir -p /app/cache && \ | |
| mkdir -p /app/app/vector_store && \ | |
| mkdir -p /app/app/uploads && \ | |
| mkdir -p /app/app/log_dir && \ | |
| mkdir -p /app/app/models/models--sentence-transformers--all-MiniLM-L6-v2 && \ | |
| # Adjust ownership to allow writing | |
| chown -R appuser:appuser /app/cache && \ | |
| chown -R appuser:appuser /app/app && \ | |
| chmod -R 777 /app/app/models/models--sentence-transformers--all-MiniLM-L6-v2 | |
| # Set environment variable for Hugging Face cache | |
| ENV HF_HOME=/app/cache | |
| # Switch to non-root user | |
| # USER appuser | |
| # Define volumes for data persistence | |
| VOLUME /app/app/vector_store | |
| VOLUME /app/app/uploads | |
| VOLUME /app/app/log_dir | |
| VOLUME /app/app/models | |
| VOLUME /app/cache | |
| # Command to run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |