File size: 1,270 Bytes
74c6d68
0353241
 
 
 
74c6d68
 
 
 
 
0353241
74c6d68
 
0353241
74c6d68
 
 
 
 
 
 
 
0353241
 
 
 
8890033
 
74c6d68
0353241
8890033
74c6d68
 
8890033
74c6d68
 
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
32
33
34
35
36
37
# ─── Dockerfile for Predictive Maintenance Streamlit App ───
# Build: docker build -t predictive-maintenance-app .
# Run:   docker run -p 8501:8501 predictive-maintenance-app
# Optional: mount a local model for offline use:
#   docker run -p 8501:8501 -v $(pwd)/models:/app/models predictive-maintenance-app

FROM python:3.11-slim

WORKDIR /app

# System deps: build-essential for any pip wheels, curl for HEALTHCHECK
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

COPY app.py .

# Optional: copy local model so the app can run without Hugging Face at runtime
# Uncomment and ensure models/ exists when building with a pre-downloaded model:
# COPY models/best_random_forest.pkl models/

# HF Spaces Docker default is app_port 7860; proxy forwards to this port
EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:7860/_stcore/health || exit 1

CMD ["streamlit", "run", "app.py", \
     "--server.port=7860", \
     "--server.address=0.0.0.0", \
     "--server.headless=true"]