File size: 1,409 Bytes
666eff5
af236d4
 
 
 
 
 
 
 
 
 
666eff5
af236d4
 
 
 
 
 
 
 
 
 
 
0823267
 
 
b27f49e
 
 
 
 
ac4114b
 
 
7431dc8
af236d4
 
 
7431dc8
 
e522921
7431dc8
 
 
2d186b2
 
af236d4
 
 
 
 
 
 
 
 
0823267
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libgomp1 \
    libgl1-mesa-dev \
    wget \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY app.py .

# Copy static files (mini app)
COPY static/ ./static/

# Create directories with proper permissions for all PaddleOCR models
RUN mkdir -p /app/.paddlex \
    /app/.paddleocr/whl/det/en/en_PP-OCRv3_det_infer \
    /app/.paddleocr/whl/rec/en/en_PP-OCRv3_rec_infer \
    /app/.paddleocr/whl/cls/en_ppocr_mobile_v2.0_cls_infer \
    /app/temp && \
    chmod -R 777 /app && \
    chown -R 1000:1000 /app

# Set environment variables
ENV PYTHONPATH=/app
ENV PADDLE_PDX_MODEL_SOURCE=BOS
ENV PADDLE_HOME=/app/.paddlex
ENV PADDLEX_HOME=/app/.paddlex
ENV PADDLEOCR_HOME=/app/.paddleocr
ENV TEMP=/app/temp
ENV TMP=/app/temp
ENV TMPDIR=/app/temp
ENV HOME=/app
ENV USER=app

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860/ || exit 1

# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]