Spaces:
Running
Running
| # Use Python 3.11 slim image | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Create a non-root user for Hugging Face | |
| RUN useradd -m -u 1000 user | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY main.py . | |
| COPY model_loader.py . | |
| COPY best_lung_cancer_model.joblib . | |
| COPY scaler.joblib . | |
| # Set ownership for Hugging Face user | |
| RUN chown -R user:user /app | |
| USER user | |
| # Hugging Face Spaces uses port 7860 | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |