triflix commited on
Commit
5b41007
·
verified ·
1 Parent(s): c08cd96

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -28
Dockerfile CHANGED
@@ -1,41 +1,25 @@
1
- # Dockerfile
2
- # Minimal, explicit CPU PaddlePaddle + PaddleOCR install for HuggingFace Space.
3
- # Installs packages via pip (no requirements.txt), uses non-root runtime user.
4
  FROM python:3.10-slim
5
 
6
- # Create a non-root user for least-privilege execution
7
- ARG USERNAME=appuser
8
- RUN groupadd -r ${USERNAME} && useradd -r -g ${USERNAME} ${USERNAME}
9
 
10
- # System dependencies required by Pillow / PyMuPDF and common Linux libs
11
- RUN apt-get update && apt-get install -y --no-install-recommends \
12
  build-essential \
13
  libgl1 \
14
  libglib2.0-0 \
15
- libsm6 \
16
- libxrender1 \
17
- libxext6 \
18
- git \
19
- ca-certificates \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  WORKDIR /app
23
 
24
- # Copy application code (expecting app.py at build time)
25
- COPY app.py /app/app.py
26
-
27
- # Install Python dependencies via pip directly inside Dockerfile (no requirements.txt)
28
- # The two lines below match user's requested commands for paddlepaddle and paddleocr (CPU).
29
- RUN pip install --upgrade pip setuptools wheel \
30
- && pip install fastapi uvicorn python-multipart pydantic Pillow PyMuPDF \
31
- && pip install paddlepaddle==3.0.0 \
32
- && python -m pip install paddleocr
33
 
34
- # Expose port used by uvicorn
35
- EXPOSE 8000
 
36
 
37
- # Switch to non-root user
38
- USER ${USERNAME}
39
 
40
- # Entrypoint - run uvicorn for the FastAPI app
41
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive
 
 
4
 
5
+ # System dependencies
6
+ RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  libgl1 \
9
  libglib2.0-0 \
10
+ poppler-utils \
 
 
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
  WORKDIR /app
14
 
15
+ # Python libs
16
+ RUN pip install --no-cache-dir fastapi uvicorn python-multipart PyMuPDF pillow
 
 
 
 
 
 
 
17
 
18
+ # REQUIRED EXACT INSTALLS (your requirement)
19
+ RUN pip install --no-cache-dir paddlepaddle==3.0.0
20
+ RUN python -m pip install --no-cache-dir paddleocr
21
 
22
+ COPY app.py /app/app.py
 
23
 
24
+ EXPOSE 7860
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]