This commit is contained in:
Manuel
2025-09-18 14:52:14 +02:00
parent 9c1e5b3df4
commit 39214e1b2b
2 changed files with 53 additions and 39 deletions

View File

@@ -1,61 +1,74 @@
# Dockerfile # STAGE 1: BUILDER
# This stage installs build tools and Python dependencies
FROM python:3.13.7-slim AS builder
ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive
# Install only the build-time dependencies needed for pip packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
git \
curl \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and install Python requirements to leverage Docker layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# STAGE 2: FINAL
# This is the lean, final image for running the application
FROM python:3.13.7-slim FROM python:3.13.7-slim
ENV PYTHONUNBUFFERED=1 \ ENV PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive DEBIAN_FRONTEND=noninteractive
# Install only the essential runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \ # OCR dependencies
tesseract-ocr-eng \ tesseract-ocr tesseract-ocr-eng tesseract-ocr-deu ghostscript poppler-utils \
tesseract-ocr-deu \
ghostscript \
poppler-utils \
libreoffice \ libreoffice \
imagemagick \ pandoc texlive-xetex \
graphicsmagick \
libvips-tools \
ffmpeg \
libheif-examples \
inkscape \
calibre \
pngquant \
pandoc \
resvg \
sox \
libvips-tools \
build-essential \
pkg-config \
git \
potrace \
curl \
texlive \
jpegoptim \
texlive-latex-recommended \ texlive-latex-recommended \
texlive-fonts-recommended \ texlive-fonts-recommended \
libxml2 \ calibre \
texlive-xetex \ ffmpeg \
texlive-science \ libvips-tools \
libxml2-dev \ libxml2-dev \
graphicsmagick \
inkscape \
resvg \
potrace \
pngquant \
sox \
jpegoptim \
libsox-fmt-mp3 \
lame \
# Runtime libraries for Python packages
libxml2 \
# Process manager
supervisor \ supervisor \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Set working directory inside the container
WORKDIR /app WORKDIR /app
# Copy requirements and install dependencies # Copy installed Python packages from the builder stage
COPY requirements.txt . COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
RUN pip install --no-cache-dir -r requirements.txt COPY --from=builder /usr/local/bin /usr/local/bin
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
# Copy the rest of the app # Copy supervisor config and application code
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
COPY . . COPY . .
# Expose port and set executable permissions
# Expose the app port
EXPOSE 8000 EXPOSE 8000
RUN chmod +x run.sh RUN chmod +x run.sh
# Command to run when container starts
#CMD ["./run.sh"] # Start the application
CMD ["/usr/bin/supervisord", "-n"] CMD ["/usr/bin/supervisord", "-n"]

View File

@@ -15,6 +15,7 @@ pytesseract
pypdf pypdf
# Configuration & Utilities # Configuration & Utilities
werkzeug
PyYAML PyYAML
pydantic pydantic
pydantic-settings pydantic-settings