pdf-4 / Dockerfile
fokan's picture
first
61b4298
# Dockerfile for Enhanced DOCX to PDF Converter
FROM ubuntu:22.04
# Set environment variables for Arabic support
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=ar_SA.UTF-8
ENV LC_ALL=ar_SA.UTF-8
ENV PYTHONUNBUFFERED=1
# Install system dependencies including Arabic fonts and Python
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
libreoffice \
libreoffice-writer \
libreoffice-l10n-ar \
libreoffice-help-ar \
fonts-liberation \
fonts-liberation2 \
fonts-dejavu \
fonts-dejavu-core \
fonts-dejavu-extra \
fonts-croscore \
fonts-noto-core \
fonts-noto-ui-core \
fonts-noto-mono \
fonts-noto-color-emoji \
fonts-noto-naskh \
fonts-noto-kufi-arabic \
fonts-opensymbol \
fonts-freefont-ttf \
fonts-amiri \
fonts-scheherazade-new \
fontconfig \
wget \
curl \
unzip \
locales \
&& rm -rf /var/lib/apt/lists/*
# Generate Arabic locale
RUN locale-gen ar_SA.UTF-8
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy application files
COPY src/ src/
COPY arial.ttf .
# Setup font configuration
RUN mkdir -p /usr/share/fonts/truetype/local-arial
RUN cp arial.ttf /usr/share/fonts/truetype/local-arial/
RUN fc-cache -fv
# Create necessary directories
RUN mkdir -p /tmp/conversions
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["python3", "src/api/app.py"]