nvalliant commited on
Commit
fcc0709
·
verified ·
1 Parent(s): 1591387

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -15
Dockerfile CHANGED
@@ -1,28 +1,26 @@
1
  FROM python:3.10-slim
2
-
3
- # HF Spaces runs as a non-root user — this satisfies that requirement
4
  RUN useradd -m -u 1000 user
5
- USER user
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
-
8
- WORKDIR /app
9
-
10
- # Install system deps needed by OpenCV
11
  USER root
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 \
14
  && rm -rf /var/lib/apt/lists/*
 
15
  USER user
16
-
17
- # Install Python deps
 
 
 
 
18
  COPY --chown=user requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
-
21
- # Copy app source and model files
22
  COPY --chown=user server.py .
23
  COPY --chown=user models/ ./models/
24
-
25
- # HF Spaces expects the app to listen on port 7860
26
  EXPOSE 7860
27
-
28
  CMD ["python", "server.py"]
 
 
1
  FROM python:3.10-slim
2
+
 
3
  RUN useradd -m -u 1000 user
4
+
 
 
 
 
 
5
  USER root
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 \
8
  && rm -rf /var/lib/apt/lists/*
9
+
10
  USER user
11
+ ENV PATH="/home/user/.local/bin:$PATH"
12
+ # Force Python to print immediately — critical for HF health checks
13
+ ENV PYTHONUNBUFFERED=1
14
+
15
+ WORKDIR /app
16
+
17
  COPY --chown=user requirements.txt .
18
  RUN pip install --no-cache-dir -r requirements.txt
19
+
 
20
  COPY --chown=user server.py .
21
  COPY --chown=user models/ ./models/
22
+
 
23
  EXPOSE 7860
24
+
25
  CMD ["python", "server.py"]
26
+