AdeogunTechno commited on
Commit
b343718
·
verified ·
1 Parent(s): 7727242

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -1
Dockerfile CHANGED
@@ -1 +1,23 @@
1
- dockerfile <br># Base image with Python 3.11 (works on HF’s infrastructure) <br>FROM python:3.11-slim <br> <br># Create a non‑root user (required for HF dev‑mode) <br>RUN useradd -m -u 1000 user <br>WORKDIR /app <br> <br># Install the Python dependencies <br>COPY --chown=user ./requirements.txt requirements.txt <br>RUN pip install --no‑cache-dir -r requirements.txt <br> <br># Copy the app code <br>COPY --chown=user . /app <br> <br># Expose the port HF will set in $PORT (default 7860) <br>ENV PORT=7860 <br>CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] <br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------------------------------------
2
+ # Dockerfile for the Food‑Recognition API Space
3
+ # ------------------------------------------------------------
4
+
5
+ # 1️⃣ Base image – python 3.11 (slim is small & works on HF infra)
6
+ FROM python:3.11-slim
7
+
8
+ # 2️⃣ Create a non‑root user (required for Hugging Face dev‑mode)
9
+ RUN useradd -m -u 1000 user
10
+ WORKDIR /app
11
+
12
+ # 3️⃣ Install the Python dependencies
13
+ COPY --chown=user ./requirements.txt requirements.txt
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # 4️⃣ Copy the application code
17
+ COPY --chown=user . /app
18
+
19
+ # 5️⃣ The port that HF will expose (default 7860)
20
+ ENV PORT=7860
21
+
22
+ # 6️⃣ Run the FastAPI server with uvicorn
23
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]