| FROM python:3.11-slim | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # socat will forward 7860 -> 9083 so your python stays unchanged | |
| RUN apt-get update && apt-get install -y --no-install-recommends socat \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY server.py . | |
| # Hugging Face expects the app to listen on 7860 | |
| EXPOSE 7860 | |
| # GOOGLE_API_KEY should be set as a Hugging Face Secret, not in code | |
| ENV GOOGLE_API_KEY="" | |
| CMD bash -lc "\ | |
| python server.py & \ | |
| socat TCP-LISTEN:7860,fork,reuseaddr TCP:localhost:9083 \ | |
| " | |