62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
# SPDX-FileCopyrightText: 2026 James R. Barlow
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# Batch web interface for OCRmyPDF.
|
|
#
|
|
# docker compose -f misc/docker-compose.webui.yml up --build
|
|
#
|
|
# Then open http://localhost:8000/
|
|
#
|
|
# There is no authentication. Run this on a trusted network, or put it behind
|
|
# a reverse proxy that handles TLS and access control.
|
|
---
|
|
services:
|
|
ocrmypdf-webui:
|
|
build:
|
|
context: ..
|
|
dockerfile: .docker/Dockerfile
|
|
image: ocrmypdf-webui
|
|
container_name: ocrmypdf-webui
|
|
restart: unless-stopped
|
|
|
|
# The image's default entrypoint is the ocrmypdf CLI; override it to start
|
|
# the web server instead.
|
|
entrypoint: ["/app/.venv/bin/python3", "-m", "webui"]
|
|
|
|
ports:
|
|
- "8772:8000"
|
|
|
|
environment:
|
|
# Files OCR'd concurrently. Each one also uses OCR_JOBS threads
|
|
# internally, so WORKERS x OCR_JOBS should be roughly your core count.
|
|
OCRMYPDF_WEBUI_WORKERS: "2"
|
|
OCRMYPDF_WEBUI_OCR_JOBS: "2"
|
|
# Limits on what a single submission may contain.
|
|
OCRMYPDF_WEBUI_MAX_FILES: "50"
|
|
OCRMYPDF_WEBUI_MAX_UPLOAD_MB: "500"
|
|
# Uploads and results are deleted this many seconds after the batch was
|
|
# submitted, whether or not they were downloaded.
|
|
OCRMYPDF_WEBUI_BATCH_TTL_SECONDS: "3600"
|
|
# Give up on any single file that takes longer than this.
|
|
OCRMYPDF_WEBUI_JOB_TIMEOUT_SECONDS: "1800"
|
|
|
|
# Uploads and results are transient, so keep them in RAM and out of the
|
|
# container's writable layer. Size this above the largest batch you expect;
|
|
# drop this block to use ordinary container storage instead.
|
|
tmpfs:
|
|
- /var/tmp/ocrmypdf-webui:size=4g,mode=1777
|
|
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- /app/.venv/bin/python3
|
|
- "-c"
|
|
- "import urllib.request;urllib.request.urlopen('http://127.0.0.1:8000/healthz').read()"
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 15s
|
|
retries: 3
|
|
|
|
security_opt:
|
|
- no-new-privileges:true
|