Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ZEROF/a3f14495db20b5287efb46e85a83e5f0 to your computer and use it in GitHub Desktop.

Select an option

Save ZEROF/a3f14495db20b5287efb46e85a83e5f0 to your computer and use it in GitHub Desktop.
Lue CLI Reader: Dockerized Text‑to‑Speech for Backbox/Ubuntu (PulseAudio)

📝 Title

Lue‑CLI‑Reader: Dockerized Text‑to‑Speech for Backbox/Ubuntu (PulseAudio)


📦 Repository Overview

A minimal, reproducible Docker setup that runs lue‑reader (a CLI PDF‑to‑speech converter) on Backbox Linux (or any Ubuntu‑based distro) with full PulseAudio support.
You can copy this solution into your own repo or use it as a template for any container‑based CLI tool that needs audio output.


✨ Features

Feature Description
Zero‑root container Runs as a non‑root user (appuser) with a writable cache directory.
PulseAudio integration Maps your local PulseAudio socket so the container can play audio on your host.
Small image Uses Debian trixie‑slim (~60 MB) and only the necessary system packages.
Easy command‑line usage A single docker run … command to read any PDF in the books/ folder.
Portability Works on Backbox Linux, Ubuntu, Debian, or any system with Docker and PulseAudio.

📁 Layout

lueclireader/
├── Dockerfile
├── README.md (if you want to make one)
└── books/   # ← put your PDF files here

🚀 Quick Start

  1. Make working env

    mkdir -p lueclireader lueclireader/books && cd lueclireader
  2. Add a book

    cp /path/to/your/book.pdf books/

🛠️ Dockerfile

FROM debian:trixie-slim

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

# Install system deps (Python, ffmpeg, espeak, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip python3-venv \
    ffmpeg \
    ca-certificates \
    espeak \
    antiword \
    alsa-utils libasound2 \
    && rm -rf /var/lib/apt/lists/*

# Create a non‑root user and a writable cache directory
RUN useradd -m appuser && \
    mkdir -p /.cache && chown appuser:appuser /.cache
ENV XDG_CACHE_HOME=/.cache

# Install lue‑reader from PyPI
RUN pip install --break-system-packages --no-cache-dir lue-reader

# Use the non‑root user
USER appuser

# Default working directory and entrypoint
WORKDIR /app
ENTRYPOINT ["lue"]
CMD ["--help"]
  1. Build the image

    docker build -t lueclireader .
  2. Run the reader

    docker run --rm -it \
      --device /dev/snd \
      -v /run/user/$UID/pulse:/run/user/$UID/pulse \
      -e PULSE_SERVER=unix:/run/user/$UID/pulse/native \
      -u $(id -u):$(id -g) \
      -v "$PWD/books:/books" \
      lueclireader /books/your‑book.pdf

Tip: Add a shell alias to avoid typing the long command every time. Check folder path to git your needs.

echo "alias lue='docker run --rm -it \
  --device /dev/snd \
  -v /run/user/$UID/pulse:/run/user/$UID/pulse \
  -e PULSE_SERVER=unix:/run/user/$UID/pulse/native \
  -u $(id -u):$(id -g) \
  -v \"$PWD/books:/books\" lueclireader'" >> ~/.bashrc
source ~/.bashrc

Now you can just type lue /books/book.pdf.


🙏 Acknowledgements

  • lue‑reader – the CLI tool that powers the audio output.
  • Backbox Linux / Ubuntu – the target environment for this Docker setup.
  • PulseAudio – the audio backend that makes the container speak.

Happy reading! 🎧📚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment