# 1. Use a standard Python slim image for a smaller footprint FROM python:3.12-slim-bookworm # Set the working directory inside the container WORKDIR /app # 2. Install necessary system dependencies for image processing (PIL/Pillow/Torchvision) # These libraries ensure proper handling of image files. RUN apt-get update && \ apt-get install -y --no-install-recommends \ libsm6 \ libxext6 \ libxrender1 && \ rm -rf /var/lib/apt/lists/* # Copy the current directory contents into the container at /app COPY . /app # Install Python dependencies from requirements.txt # Using --default-timeout is good practice, but not strictly required here. RUN pip install --upgrade pip RUN pip install --default-timeout=100 --no-cache-dir -r requirements.txt # 3. Expose the port required by Hugging Face Spaces (MANDATORY) EXPOSE 7860 # 4. Command to run the FastAPI application using uvicorn. # We point uvicorn to the app instance: Skin-Cancer.app:app # The host must be 0.0.0.0 and the port MUST be 7860. CMD ["uvicorn", "Skin-Cancer.app:app", "--host", "0.0.0.0", "--port", "7860"]