arshvir commited on
Commit
de7a5f3
·
verified ·
1 Parent(s): 96274ee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -13
Dockerfile CHANGED
@@ -1,38 +1,31 @@
1
- # 1. Base image
2
- FROM python:3.9-slim
3
 
4
- # 2. Create non-root user (HF requirement)
5
  RUN useradd -m -u 1000 user
6
  USER user
7
 
8
- # 3. Environment
9
  ENV PATH="/home/user/.local/bin:$PATH"
10
  WORKDIR /app
11
 
12
- # 4. System dependencies (OpenCV + git)
13
  USER root
14
  RUN apt-get update && apt-get install -y \
15
  libgl1 \
16
  libglib2.0-0 \
17
  git \
18
  && rm -rf /var/lib/apt/lists/*
19
-
20
  USER user
21
 
22
- # 5. Copy requirements first (cache-friendly)
23
  COPY --chown=user requirements.txt .
24
-
25
- # 6. Install Python dependencies
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # 7. Copy application code
29
  COPY --chown=user . .
30
 
31
- # 8. Create upload directory safely
32
  RUN mkdir -p static/uploads
33
 
34
- # 9. Hugging Face port
35
  EXPOSE 7860
36
 
37
- # 10. Production server
38
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
1
+ FROM python:3.9-bullseye
 
2
 
3
+ # Create non-root user (HF requirement)
4
  RUN useradd -m -u 1000 user
5
  USER user
6
 
 
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
  WORKDIR /app
9
 
10
+ # System deps
11
  USER root
12
  RUN apt-get update && apt-get install -y \
13
  libgl1 \
14
  libglib2.0-0 \
15
  git \
16
  && rm -rf /var/lib/apt/lists/*
 
17
  USER user
18
 
19
+ # Python deps
20
  COPY --chown=user requirements.txt .
 
 
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # App code
24
  COPY --chown=user . .
25
 
26
+ # Upload dir
27
  RUN mkdir -p static/uploads
28
 
 
29
  EXPOSE 7860
30
 
 
31
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]