File size: 1,232 Bytes
46d54ad
 
 
 
 
 
0bde93f
25b126e
 
 
 
0bde93f
25b126e
 
46d54ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /home/user/app

# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    wget curl git build-essential cmake pkg-config \
    libcairo2-dev libpango1.0-dev libfreetype6-dev libglib2.0-dev \
    libjpeg-dev libpng-dev libopenjp2-7-dev libtiff-dev libxml2-dev \
    libpoppler-dev libpoppler-cpp-dev libpoppler-glib-dev poppler-utils \
    fontforge \
    fonts-dejavu fonts-liberation fonts-noto fonts-noto-cjk fonts-thai-tlwg \
    && rm -rf /var/lib/apt/lists/* && apt-get clean

# Build pdf2htmlEX from source
RUN git clone --depth 1 https://github.com/pdf2htmlEX/pdf2htmlEX.git /tmp/pdf2htmlEX \
    && cd /tmp/pdf2htmlEX \
    && mkdir build && cd build \
    && cmake .. -DCMAKE_INSTALL_PREFIX=/usr \
    && make -j"$(nproc)" \
    && make install \
    && rm -rf /tmp/pdf2htmlEX

# Create non-root user
RUN useradd -m -u 1000 user
USER user

# Python deps
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir -r requirements.txt

# App code
COPY --chown=user:user . .

RUN mkdir -p /home/user/app/temp /home/user/app/output

EXPOSE 7860
CMD ["python", "app.py"]