File size: 618 Bytes
e5fa3ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.10 base
FROM python:3.10-slim

# set workdir
WORKDIR /app

# system deps (minimal)
RUN apt-get update && apt-get install -y build-essential gcc --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# copy files
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY . /app

# If you want to train inside container uncomment next line:
# RUN python train_model.py

# Expose HF expected port 7860
EXPOSE 7860

# Run uvicorn on port 7860 (HF expects server on this port)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]