ML_classifier / Dockerfile
MadalinaCarcea221989
Deploy CloudPulse AI service
81e3338
Raw History Blame Contribute Delete
1.19 kB
# 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"]