A lightweight, automated Docker container that acts as a background conversion pipeline for your digital library.
This tool continuously monitors an input directory for new ebook files and automatically converts them to a standardized format (default: EPUB) using Calibre's powerful ebook-convert engine. Once converted, the new file is moved to your output directory, and the original file is deleted to save space.
Perfect for preprocessing books before syncing them into self-hosted library managers like BookOrbit, Grimmory, Calibre-Web, or OpenCloud/Nextcloud.
inotifywait to instantly detect when a file finishes uploading or moving into the folder..azw, .azw3, .mobi, .pdf, .docx, and more.Clone this repository to your local machine and build the Docker image:
git clone https://github.com/tobiv/ebook-epubify.git
cd ebook-epubify
docker build -t ebook-epubify .
Create or modify a docker-compose.yml file:
services:
ebook-converter:
image: ebook-epubify
container_name: ebook-epubify
environment:
- INPUT_FORMATS=azw,azw3,mobi,pdf,docx,txt,rtf,lit,lrf
- OUTPUT_FORMAT=epub
- PUID=1000
- PGID=1000
volumes:
# Map your host folders to /input and /output
- /path/to/your/upload_folder:/input
- /path/to/your/destination_folder:/output
restart: unless-stopped
Start the service:
docker compose up -d
Run the container directly via the command line:
docker run -d \
--name ebook-converter \
-e INPUT_FORMATS="azw,azw3,mobi,pdf,cbz,cbr,docx,txt" \
-e OUTPUT_FORMAT="epub" \
-e PUID=1000 \
-e PGID=1000 \
-v /path/to/your/upload_folder:/input \
-v /path/to/your/destination_folder:/output \
--restart unless-stopped \
ebook-epubify
You can customize the script's behavior using the following environment variables:
| Variable | Default Value | Description |
|---|---|---|
INPUT_FORMATS | azw,azw3,mobi,pdf,docx,txt,rtf,lit,lrf | A comma-separated list of file extensions the script will listen for. Files with extensions not on this list will be completely ignored. |
OUTPUT_FORMAT | epub | The target file format. Calibre supports extensive output formats including epub, mobi, azw3, pdf, and txt. |
If you map this container's volumes directly into the backend data directories of an OpenCloud, Nextcloud, or ownCloud instance, the conversion will work perfectly on the filesystem. However, the Nextcloud web interface will not instantly see the new files because the internal database was bypassed.
To fix this, you must run the Nextcloud file scan command periodically, or trigger it via a cron job on your host server:
# Example command for Nextcloud
sudo -u www-data php /var/www/nextcloud/occ files:scan --path="user_id/files/destination_folder"
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is licensed under the MIT License - see the LICENSE file for details. Calibre is licensed under the GNU GPL v3.
Content type
Image
Digest
sha256:770cebe08…
Size
652.5 MB
Last updated
about 23 hours ago
docker pull tobvor/ebook-epubify