# Use official Python 3.11 slim image FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ wget \ supervisor \ && rm -rf /var/lib/apt/lists/* # ── Remove ALL default supervisor configs shipped by apt ───────────────────── RUN rm -f /etc/supervisor/supervisord.conf \ /etc/supervisor/conf.d/*.conf # Copy requirements first (for layer caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # ── Place our supervisor config at the root level so it is fully standalone ── COPY supervisord.conf /etc/supervisord.conf RUN chmod 644 /etc/supervisord.conf # ── Copy and permission the entrypoint cleanup script ──────────────────────── COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh # ── Create runtime directories with correct permissions ────────────────────── RUN mkdir -p /app/logs /app/ranker_logs && \ chmod 777 /app/logs /app/ranker_logs # Expose hub (7860 = HuggingFace public) + dashboard (8051 = internal) EXPOSE 7860 8051 USER root # Entrypoint cleans up stale state, then execs supervisord CMD ["/entrypoint.sh"]