FROM python:3.12-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Clone the bazi library — pinned to a fixed commit (2026-07-09) so upstream # changes/deletions can't silently alter or break our production builds RUN git clone https://github.com/china-testing/bazi.git /app/bazi_lib \ && git -C /app/bazi_lib checkout 7150d5b6fba5e563dd0751b957dc990bb84ab6f0 # Copy all application code COPY *.py . # Copy data directory for rituals database COPY data/ ./data/ # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]