File size: 1,186 Bytes
81e3338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
# syntax=docker/dockerfile:1.7
# ==============================================================================
# CloudPulse AI Service — Hugging Face Spaces deployment
# HF Spaces requires the app to listen on port 7860
# ==============================================================================

FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    OMP_NUM_THREADS=2 \
    OPENBLAS_NUM_THREADS=2 \
    MKL_NUM_THREADS=2

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    gcc \
    libgomp1 \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements-api.txt .
RUN pip install --upgrade pip && \
    pip install -r requirements-api.txt

# Copy artefacts and API code
COPY artefacts/ ./artefacts/
COPY api/ ./api/

# HF Spaces runs as root, no need for user creation
EXPOSE 7860

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

CMD ["uvicorn", "api.main:app", \
    "--host", "0.0.0.0", \
    "--port", "7860", \
    "--workers", "1", \
    "--log-level", "info"]