FoodClassifierAPI / Dockerfile
AdeogunTechno's picture
Update Dockerfile
b343718 verified
Raw
History Blame Contribute Delete
782 Bytes
# ------------------------------------------------------------
# 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"]