File size: 620 Bytes
fa01bf1
 
 
 
 
ee093d4
 
 
fa01bf1
 
 
 
 
 
 
 
6f2b9f4
 
 
465715f
ee093d4
 
fa01bf1
ee093d4
fa01bf1
ee093d4
 
fa01bf1
ee093d4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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"]