File size: 1,802 Bytes
9c010d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0730d8e
 
9c010d5
0ff2680
9c010d5
 
0730d8e
 
9c010d5
0ff2680
 
 
 
 
 
 
 
 
9c010d5
0ff2680
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
57
58
# Use --platform to specify architecture
FROM --platform=linux/amd64 ubuntu:latest

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# Install system dependencies including Python3 and pip3
RUN apt update && apt install -y \
    python3 \
    python3-pip \
    python3-venv \
    libglib2.0-0 \
    libfreetype6 \
    libfontconfig1 \
    libcairo2 \
    libpng16-16 \
    libjpeg-turbo8 \
    libxml2 \
    wget \
    libreoffice \
    && apt upgrade -y \
    && rm -rf /var/lib/apt/lists/*

# Create symlinks for python and pip (optional, for convenience)
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
    ln -sf /usr/bin/pip3 /usr/bin/pip

RUN python3 -m pip config set global.break-system-packages true

# Set working directory
WORKDIR /var/app

# Copy and install PDF2htmlEX
RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/install.sh" -O ./install.sh
RUN chmod +x install.sh && ./install.sh

# Copy Python requirements and install dependencies
# RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/demo/install.txt" -O ./install.txt
COPY install.txt install.txt
RUN pip3 install --no-cache-dir --upgrade -r install.txt
RUN pip3 install --no-cache-dir gradio

# Copy application code
# RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/demo/server.py" -O ./server.py
COPY server.py server.py

RUN mkdir -p uploads
# Expose the port that Gradio will run on
EXPOSE 7860

# Set environment variable for Gradio
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
CMD ["python3", "server.py"]

# Run the application
# CMD ["gunicorn", "-b", "0.0.0.0:7860", "--capture-output", "server:app", "--timeout=600", "--workers=10"]