File size: 940 Bytes
8a64cb0
 
f246fdc
 
 
 
 
de96900
f246fdc
de96900
f246fdc
 
 
 
448cfe5
f246fdc
 
 
df5984f
f246fdc
df5984f
de96900
f246fdc
8a64cb0
 
f246fdc
 
df5984f
f246fdc
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM python:3.11-slim

# 1) System deps (for building some wheels)
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
      build-essential libffi-dev git \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 2) Copy & install Python deps
COPY requirements.txt .
RUN pip install --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt

# 3) Fix problematic websockets lib
RUN pip uninstall -y wsproto || true \
 && pip install --no-cache-dir websockets PyNaCl

# 4) Force DNS in-container (optional, remove if you don’t need it)
RUN echo -e "nameserver 8.8.8.8\nnameserver 1.1.1.1" > /etc/resolv.conf

# 5) Copy your application code
COPY . .

# 6) Expose HF default port
EXPOSE 7860

# 7) Launch via Gunicorn: 1 worker, binds port 7860
CMD ["gunicorn", "app:app", \
     "--worker-class", "uvicorn.workers.UvicornWorker", \
     "--bind", "0.0.0.0:7860", \
     "--workers", "1", \
     "--log-level", "info"]