triflix commited on
Commit
64368c4
·
verified ·
1 Parent(s): f04e35a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -22
Dockerfile CHANGED
@@ -1,34 +1,25 @@
1
- FROM python:3.9-slim
2
 
3
- WORKDIR /app
4
-
5
- # Install system dependencies for OpenCV and PaddleOCR
6
  RUN apt-get update && apt-get install -y \
7
- libgl1 \
8
  libglib2.0-0 \
9
  libsm6 \
10
  libxrender1 \
11
  libxext6 \
12
- libgomp1 \
13
- poppler-utils \
14
- && rm -rf /var/lib/apt/lists/*
15
 
16
- # Copy requirements first (for better caching)
17
- COPY requirements.txt .
18
 
19
- # Install Python dependencies
20
- RUN pip install --no-cache-dir paddlepaddle==3.0.0 && \
21
- python -m pip install --no-cache-dir paddleocr && \
22
- pip install --no-cache-dir -r requirements.txt
23
 
24
- # Copy application code
25
- COPY app.py .
 
26
 
27
- # Expose port (HuggingFace Spaces uses 7860)
28
  EXPOSE 7860
29
 
30
- # Set environment variables
31
- ENV PYTHONUNBUFFERED=1
32
-
33
- # Run the application
34
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
+ FROM python:3.10-slim
2
 
3
+ # System deps
 
 
4
  RUN apt-get update && apt-get install -y \
5
+ poppler-utils \
6
  libglib2.0-0 \
7
  libsm6 \
8
  libxrender1 \
9
  libxext6 \
10
+ && apt-get clean
 
 
11
 
12
+ # RAM disk (tmpfs inside container handled by HF Space runtime)
13
+ RUN mkdir -p /tmp/ramdisk
14
 
15
+ # Install Python deps
16
+ COPY requirements.txt /app/requirements.txt
17
+ RUN pip install --no-cache-dir -r /app/requirements.txt
 
18
 
19
+ # FastAPI app
20
+ COPY app.py /app/app.py
21
+ WORKDIR /app
22
 
 
23
  EXPOSE 7860
24
 
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]