crop_ai_diseases / Dockerfile
vivek12coder's picture
Upload 20960 files
c8df794 verified
# Use Python 3.10 slim image for better compatibility with HF Spaces
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire project
COPY . .
# Create necessary directories
RUN mkdir -p models knowledge_base src data outputs
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Set environment variable for Hugging Face Spaces
ENV GRADIO_SERVER_NAME="0.0.0.0"
# Run the FastAPI application with Uvicorn on port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]