Skip to content

CLI seems to be broken on latest release #71

Description

@alwolmer

I am attempting to use the latest release for debian-based systems (.deb file), in order to leverage Scantailor Experimental's filters to do some scan processing wrapped in a webserver, but the CLI seems to be broken. Specifically it fails on filter 6, which seems to me to be just before actually writing the output file to a temp_dir. The following is my Dockerfile, which contains the precise environment for the installation and hosting container.

# ---------- Stage 1: install scantailor-experimental-cli ----------
FROM ubuntu:24.04 AS stxp

ENV DEBIAN_FRONTEND=noninteractive \
    STXP_RELEASE="1.2025.07.07"

# Install tools to fetch .deb
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates wget dpkg apt-transport-https \
    libqt5core5a libqt5gui5 libqt5widgets5 libqt5xml5 libqt5opengl5 libtiff6\
    && rm -rf /var/lib/apt/lists/*

# Download the license and the deb package
WORKDIR /tmp
RUN wget https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental/releases/download/${STXP_RELEASE}/license-gpl_3.0-20171206_all.deb \
    && wget https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental/releases/download/${STXP_RELEASE}/scantailor-experimental_${STXP_RELEASE}-deb12_amd64.deb

# Install the .deb packages
RUN dpkg -i license-gpl_3.0-20171206_all.deb \
    && dpkg -i scantailor-experimental_${STXP_RELEASE}-deb12_amd64.deb || apt-get -f install -y \
    && rm -f *.deb

RUN which scantailor-experimental-cli || true

# ---------- Stage 2: runtime base with OS packages ----------
FROM ubuntu:24.04 AS runtime-base

ENV DEBIAN_FRONTEND=noninteractive \
    PIP_NO_CACHE_DIR=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

# OS packages for ocrmypdf and OpenCV runtime

# Build jbig2enc
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential git ca-certificates autotools-dev automake libtool libleptonica-dev pkg-config \
 && git clone https://github.com/agl/jbig2enc.git \
 && cd jbig2enc && ./autogen.sh && ./configure && make install && cd .. && rm -rf jbig2enc \
 && apt-get purge -y build-essential git autotools-dev automake libtool pkg-config \
 && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*


# Runtime deps (Python + OCR + Qt GUI runtime + Mesa)
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip python3-venv python3-dev \
    poppler-utils img2pdf tesseract-ocr tesseract-ocr-por ghostscript qpdf pngquant unpaper \
    libglib2.0-0 libgl1 libglx-mesa0 libglu1-mesa libgl1-mesa-dri mesa-utils \
    libqt5core5a libqt5gui5 libqt5widgets5 libqt5xml5 libqt5opengl5 qtwayland5 \
    libqt5network5 zlib1g libtiff6 xvfb \
    && rm -rf /var/lib/apt/lists/*

# Copy full installation from builder
COPY --from=stxp /usr/bin/scantailor-experimental /usr/bin/scantailor-experimental
COPY --from=stxp /usr/bin/scantailor-experimental-cli /usr/bin/scantailor-experimental-cli
 
# Test binary presence
RUN scantailor-experimental-cli --help || true

# ---------- Stage 3: Python app ----------
FROM runtime-base

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Change the working directory to the `app` directory
WORKDIR /app

# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
    --mount=type=bind,source=uv.lock,target=uv.lock \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    uv sync --locked --no-install-project --no-editable

# Copy the project into the intermediate image
ADD app/ /app/

# Sync the project
COPY pyproject.toml uv.lock /app/
RUN --mount=type=cache,target=/root/.cache/uv \
    uv sync --locked --no-editable

HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD curl -f http://localhost:8000/healthz || exit 1
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser

ENV UVICORN_PORT=8000 UVICORN_HOST=0.0.0.0
EXPOSE 8000
CMD ["uv","run","uvicorn","main:app","--host","0.0.0.0","--port","8000"]

The console output I'm getting is:

Image Image

I haven't found much documentation on the CLI at all, has its development been discontinued? Or is there a fix that would allow me to use its capabilities (even if in a more limited fashion than when using the GUI)? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions