FROM python:3.11.6-slim # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # 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 . . # Ensure all directories exist RUN find . -type d -exec mkdir -p {} \; 2>/dev/null || true # Set PYTHONPATH to include the current directory and all subdirectories ENV PYTHONPATH=/app:/app/controller:/app/controller/models:/app/models:/app/utils # Make startup script executable RUN chmod +x /app/startup.sh # Expose port EXPOSE 7860 # Run the startup script WORKDIR /app CMD ["/bin/bash", "/app/startup.sh"]