pdf1 / Dockerfile
kalhdrawi's picture
Upload 8 files
949ab69 verified
# Using Ubuntu 22.04 because it ships with Python 3.10, matching python3-uno perfectly
FROM ubuntu:22.04
# Environment settings
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV PYTHONUNBUFFERED=1
# Install system dependencies
# python3-uno is critical for fast conversion (UNO interface)
RUN apt-get update && \
apt-get install -y \
python3 \
python3-pip \
python3-uno \
python3-setuptools \
python3-wheel \
python3-dev \
build-essential \
libreoffice \
libreoffice-writer \
libreoffice-java-common \
default-jre \
fonts-liberation \
fonts-noto-core \
fonts-noto-mono \
fonts-noto-color-emoji \
fonts-freefont-ttf \
fontconfig \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy configuration files
COPY requirements.txt .
COPY fonts.conf .
# Install Python dependencies using system pip (to match python3-uno)
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy local fonts
COPY fonts/ /usr/share/fonts/truetype/arabic-enhanced/
# Configure fontconfig
RUN mkdir -p /etc/fonts/conf.d && \
cp fonts.conf /etc/fonts/local.conf && \
fc-cache -fv
# Verify fonts
RUN fc-list | grep -i "arial" | head -n 5
# Copy application code
COPY app ./app
COPY start.sh .
# Setup user
RUN useradd -m -u 1000 user
# Grant permissions to the user for the app directory
RUN chown -R user:user /app
RUN chmod +x start.sh
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
EXPOSE 7860
CMD ["./start.sh"]