Spaces:
Sleeping
Sleeping
yonnel
Refactor data directory creation in build_index.py to use absolute path and add permission checks
7bec29d
FROM python:3.9-slim | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
g++ \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy requirements first for better caching | |
COPY requirements.txt . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY app/ ./app/ | |
# Create data directory with proper permissions | |
RUN mkdir -p app/data && chmod 777 app/data | |
# Make start script executable | |
RUN chmod +x app/start.py | |
# Expose port | |
EXPOSE 7860 | |
# Health check with longer timeout for initial build | |
HEALTHCHECK --interval=30s --timeout=30s --start-period=300s --retries=3 \ | |
CMD curl -f http://localhost:7860/health || exit 1 | |
# Run the startup script that builds index if needed, then starts the API | |
CMD ["python", "app/start.py"] |