File size: 571 Bytes
a5e5da8
 
 
 
 
e95ae6e
a5e5da8
dd06b07
 
 
a5e5da8
dd06b07
 
 
a5e5da8
 
dd06b07
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 \
    "