Shubham9008/leaf_detection_eith_gatekeeper
0
1# Use an official Python runtime as a parent image2FROM python:3.11-slim3 4# Install system dependencies (required for OpenCV and tensorflow)5RUN apt-get update && apt-get install -y \6 libgl1 \7 libglib2.0-0 \8 && rm -rf /var/lib/apt/lists/*9 10# Set the working directory in the container11WORKDIR /app12 13# Copy the uv binary for fast package installation14COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/15 16# Copy the dependency management files17COPY pyproject.toml uv.lock ./18 19# Install dependencies using uv into a virtual environment20RUN uv sync --frozen --no-cache21 22# Copy the rest of the application files23COPY api/ ./api24COPY models/ ./models25COPY static/ ./static26COPY templates/ ./templates27COPY main.py ./28 29# Give write permissions to the application directory for non-root users (like HF's user 1000)30RUN chmod -R 777 /app31 32# Switch to the non-root user (UID 1000) that Hugging Face Spaces runs as33USER 100034 35# Expose port 7860 (Hugging Face default port)36EXPOSE 786037 38# Start the application using the installed uvicorn inside the virtual environment39CMD ["/app/.venv/bin/uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860"]40 