Files
crm.clientright.ru/pdf_processor/Dockerfile
Fedor 01c4fe80b5 chore: snapshot current working tree changes
Save all currently accumulated repository changes as a backup snapshot for Gitea so no local work is lost.
2026-03-26 14:19:01 +03:00

60 lines
1.4 KiB
Docker

# PDF Processor Microservice
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# For bash script
bash \
jq \
wget \
curl \
# ImageMagick for image conversion
imagemagick \
# Ghostscript for PDF operations
ghostscript \
# LibreOffice for document conversion
libreoffice-core \
libreoffice-writer \
libreoffice-calc \
libreoffice-impress \
# Fonts for proper rendering
fonts-liberation \
fonts-dejavu \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Fix ImageMagick policy to allow PDF operations
RUN sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml || true
# Set working directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY app/ ./app/
COPY scripts/ ./scripts/
# Make script executable
RUN chmod +x ./scripts/process_pdfs.sh
# Create temp directories
RUN mkdir -p /tmp/pdf_work /tmp/pdf_output
# Expose port
EXPOSE 8300
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8300/health || exit 1
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8300"]