chronos2-excel-forecasting-api / Dockerfile.spaces
ttzzs's picture
Deploy Chronos2 Forecasting API v3.0.0 with new SOLID architecture
c40c447 verified
# Dockerfile optimizado para HuggingFace Spaces
# Using new v3 architecture
FROM python:3.10-slim
# Environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PORT=7860 \
MODEL_ID=amazon/chronos-2 \
DEVICE_MAP=cpu
# Working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code (NEW v3 architecture)
COPY app/ ./app/
# Copy static files (Excel Add-in)
COPY static/ ./static/
# Copy docs (optional but good to have)
COPY docs/ ./docs/ 2>/dev/null || true
# Create non-root user
RUN useradd -m -u 1000 user && \
chown -R user:user /app
USER user
# Expose port (HF Spaces uses 7860)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Start command - USING NEW MAIN_V3
CMD ["uvicorn", "app.main_v3:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]