Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +48 -0
Dockerfile
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use --platform to specify architecture
|
| 2 |
+
FROM --platform=linux/amd64 ubuntu:latest
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Install system dependencies including Python3 and pip3
|
| 9 |
+
RUN apt update && apt install -y \
|
| 10 |
+
python3 \
|
| 11 |
+
python3-pip \
|
| 12 |
+
python3-venv \
|
| 13 |
+
libglib2.0-0 \
|
| 14 |
+
libfreetype6 \
|
| 15 |
+
libfontconfig1 \
|
| 16 |
+
libcairo2 \
|
| 17 |
+
libpng16-16 \
|
| 18 |
+
libjpeg-turbo8 \
|
| 19 |
+
libxml2 \
|
| 20 |
+
wget \
|
| 21 |
+
libreoffice \
|
| 22 |
+
&& apt upgrade -y \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# Create symlinks for python and pip (optional, for convenience)
|
| 26 |
+
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
|
| 27 |
+
ln -sf /usr/bin/pip3 /usr/bin/pip
|
| 28 |
+
|
| 29 |
+
RUN python3 -m pip config set global.break-system-packages true
|
| 30 |
+
|
| 31 |
+
# Set working directory
|
| 32 |
+
WORKDIR /var/app
|
| 33 |
+
|
| 34 |
+
# Copy and install PDF2htmlEX
|
| 35 |
+
RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/install.sh" -O ./install.sh
|
| 36 |
+
RUN chmod +x install.sh && ./install.sh
|
| 37 |
+
|
| 38 |
+
# Copy Python requirements and install dependencies
|
| 39 |
+
RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/demo/install.txt" -O ./install.txt
|
| 40 |
+
# COPY install.txt install.txt
|
| 41 |
+
RUN pip3 install --no-cache-dir --upgrade -r install.txt
|
| 42 |
+
|
| 43 |
+
# Copy application code
|
| 44 |
+
RUN wget "https://raw.githubusercontent.com/preprocess-co/rag-document-viewer/refs/heads/main/demo/server.py" -O ./server.py
|
| 45 |
+
# COPY server.py server.py
|
| 46 |
+
|
| 47 |
+
# Run the application
|
| 48 |
+
CMD ["gunicorn", "-b", "0.0.0.0:80", "--capture-output", "server:app", "--timeout=600", "--workers=10"]
|