# Use official Python lightweight image FROM python:3.11-slim # Set working directory WORKDIR /app # Install git (required to install packages from github if needed) RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Copy requirements file and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN pip install git+https://github.com/amazon-science/chronos-forecasting.git # Copy the rest of the application COPY . . # Expose the port Uvicorn will run on (Hugging Face Spaces defaults to 7860, Render also uses PORT) EXPOSE 7860 # Command to run the application # We use the $PORT environment variable which Hugging Face sets to 7860, or default to 7860 CMD ["sh", "-c", "uvicorn api:app --host 0.0.0.0 --port ${PORT:-7860}"]