Files
locviettriandClaude Opus 4.6 1f78b76eb4 feat(docker): add per-engine Docker dev environments (#649)
Replace the single legacy Dockerfile (rapidocr_api only) with 7
per-engine development images covering all supported inference backends:

- onnxruntime-cpu: ONNX Runtime on CPU (python:3.10-slim-bookworm)
- onnxruntime-gpu: ONNX Runtime with CUDA (nvidia/cuda:12.4.1)
- tensorrt: NVIDIA TensorRT (nvcr.io/nvidia/deepstream:7.0-gc-triton-devel)
- paddle: PaddlePaddle CPU
- openvino: Intel OpenVINO
- pytorch: PyTorch CPU
- mnn: Alibaba MNN

Infrastructure:
- Dockerfile.base: shared foundation for CPU variants
- docker-compose.yaml: all 7 services with shared model volume
- Makefile: make build-*/test-*/shell-* convenience commands
- .dockerignore: excludes .git, models, build artifacts

Key design decisions:
- PYTHONPATH-based imports (setup.py incompatible with pip editable install)
- Named volume (rapidocr-models) for persistent model cache across rebuilds
- Source bind-mounted at runtime for live editing
- tensorrt pinned to 8.6.x + cuda-python 12.x (matching DeepStream 7.0)

All 7 images built and tested with full OCR pipeline inference.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 17:29:41 +08:00

38 lines
1.1 KiB
Makefile

# RapidOCR Docker Dev Environments
COMPOSE_FILE := docker/docker-compose.yaml
ENGINES := onnxruntime-cpu onnxruntime-gpu tensorrt paddle openvino pytorch mnn
.PHONY: help build-all clean $(foreach e,$(ENGINES),build-$(e) test-$(e) shell-$(e))
help:
@echo "RapidOCR Docker Dev Environments"
@echo ""
@echo "Usage:"
@echo " make build-{engine} Build a dev image"
@echo " make test-{engine} Run tests in container"
@echo " make shell-{engine} Open bash shell in container"
@echo " make build-all Build all images"
@echo " make clean Remove all containers and images"
@echo ""
@echo "Engines: $(ENGINES)"
@echo ""
@echo "Examples:"
@echo " make build-tensorrt"
@echo " make test-onnxruntime-cpu"
@echo " make shell-pytorch"
build-%:
docker compose -f $(COMPOSE_FILE) build $*
test-%:
docker compose -f $(COMPOSE_FILE) run --rm $* pytest tests/ -v
shell-%:
docker compose -f $(COMPOSE_FILE) run --rm $* bash
build-all:
docker compose -f $(COMPOSE_FILE) build
clean:
docker compose -f $(COMPOSE_FILE) down --rmi local --volumes