helinc commited on
Commit
161e04c
·
verified ·
1 Parent(s): 8f983d8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -25
Dockerfile CHANGED
@@ -1,25 +1,27 @@
1
- # Dockerfile for Hugging Face Space (FastAPI)
2
- FROM python:3.10-slim
3
-
4
- # Optional: system libraries some packages rely on
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
- libglib2.0-0 \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- WORKDIR /code
10
-
11
- # Install Python dependencies
12
- COPY requirements.txt .
13
- RUN pip install --no-cache-dir -r requirements.txt
14
-
15
- # Copy app code
16
- COPY app ./app
17
-
18
- # Ensure output dir exists
19
- RUN mkdir -p /code/app/static/processed
20
-
21
- # HF Spaces exposes $PORT (defaults to 7860)
22
- ENV PORT=7860
23
-
24
- # Start FastAPI with uvicorn
25
- CMD ["bash", "-lc", "python -m uvicorn app.main:app --host 0.0.0.0 --port $PORT"]
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Bust the cache when you change this number:
4
+ ARG CACHEBUST=2
5
+
6
+ # Minimal system libs (glib needed by many wheels; libgl fixes GUI builds if they ever slip in)
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 && \
9
+ rm -rf /var/lib/apt/lists/*
10
+
11
+ WORKDIR /code
12
+
13
+ COPY requirements.txt .
14
+
15
+ # Clean install: upgrade tools, remove any GUI OpenCV if cached, then install headless deps
16
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
17
+ pip uninstall -y opencv-python opencv-contrib-python || true && \
18
+ pip install --no-cache-dir -r requirements.txt
19
+
20
+ COPY app ./app
21
+
22
+ RUN mkdir -p /code/app/static/processed
23
+
24
+ ENV PORT=7860
25
+
26
+ CMD ["bash","-lc","python -m uvicorn app.main:app --host 0.0.0.0 --port $PORT"]
27
+