File size: 782 Bytes
b343718
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ------------------------------------------------------------
# Dockerfile for the Food‑Recognition API Space
# ------------------------------------------------------------

# 1️⃣ Base image – python 3.11 (slim is small & works on HF infra)
FROM python:3.11-slim

# 2️⃣ Create a non‑root user (required for Hugging Face dev‑mode)
RUN useradd -m -u 1000 user
WORKDIR /app

# 3️⃣ Install the Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# 4️⃣ Copy the application code
COPY --chown=user . /app

# 5️⃣ The port that HF will expose (default 7860)
ENV PORT=7860

# 6️⃣ Run the FastAPI server with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]