Spaces:
Sleeping
Sleeping
File size: 1,017 Bytes
19165a3 73888be 19165a3 73888be 19165a3 73888be 19165a3 73888be | 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 | FROM python:3.10-slim
WORKDIR /app
# Install system dependencies for numpy, pandas, PIL, etc.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
gcc \
git \
wget \
curl \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Set environment variables for UTF-8 and production
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
COPY . .
# Expose the port for Hugging Face Spaces
EXPOSE 7860
# Healthcheck (optional, but recommended for cloud)
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl --fail http://localhost:7860/docs || exit 1
# Use python -m uvicorn for reliability
CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"] |