feat(server): add REST API + Docker for light-ocr#24
Closed
chatre7 wants to merge 9 commits into
Closed
Conversation
Design a standalone Express server under server/ that wraps the published @arcships/light-ocr npm package and a single-stage Dockerfile that runs it, so the OCR engine can be called over HTTP. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pin @arcships/light-ocr to an exact version, tag Docker images by the server's own version, and document the manual update process. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Six-task TDD plan: error mapping, engine lifecycle wrapper, health/info endpoints, POST /ocr, graceful shutdown, and Dockerfile/compose/docs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Verified with a real docker build/run/curl cycle: node:22-slim's glibc 2.36 is too old for the native addon (needs 2.38+), so the base image is node:22-trixie-slim instead. Spec and plan docs updated to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
感谢提交这个 PR,server-side OCR 服务是一个真实的需求场景,实现质量也很扎实。 我们刚更新了 Roadmap 并新增了 Monorepo 设计文档(见 #26),明确了 设计共识
对你的 PR 的具体影响代码结构和实现思路完全可用,需要调整的主要是放置位置:
建议
如果你愿意按这个方向调整,我可以帮忙 review 独立仓库版本。 |
chatre7
added a commit
to chatre7/light-ocr-server
that referenced
this pull request
Jul 21, 2026
Standalone repo per arcships/light-ocr#24 review feedback: server deployment artifacts live here until the light-ocr monorepo migration (N2 phase) lands, at which point this moves to packages/light-ocr-server/. GET /health, GET /info, POST /ocr (multipart image upload) backed by one shared @arcships/light-ocr engine instance. Single-stage Dockerfile (node:22-trixie-slim - glibc 2.36 in node:22-slim is too old for the native addon, which needs 2.38+). Graceful shutdown drains the engine on SIGTERM/SIGINT. 15/15 tests pass (node --test); docker build/run/curl verified locally against a real image, including graceful `docker stop`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Thanks for the detailed guidance — makes sense. I've moved the implementation to a standalone repo per your suggestion: https://github.com/chatre7/light-ocr-server Changes from this PR's version:
Closing this PR — will resubmit against |
eric8810
added a commit
that referenced
this pull request
Jul 22, 2026
Migrate the REST and Docker implementation promised by PR #24 into the N2 workspace while keeping its package private at 0.1.0. Bound uploads before buffering, preserve OcrError semantics, support Linux x64 and arm64 images, and route workspace checks away from the full Core CI job. Co-authored-by: chatre7 <chatree.yosnak@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server/) wrapping the published@arcships/light-ocrnpm package:GET /health,GET /info,POST /ocr(multipart image upload)server/Dockerfile(node:22-trixie-slim— verifiednode:22-slim's glibc 2.36 is too old for the native addon, which needs 2.38+) and a rootdocker-compose.ymlcpu/auto/webgpu), queue capacity, and port are configurable via env vars; graceful shutdown drains the engine onSIGTERM/SIGINTdocs/superpowers/specs/2026-07-21-rest-api-docker-design.mddocs/superpowers/plans/2026-07-21-rest-api-docker.mdThis is additive only — no changes to
bindings/nodeor the C++ core.Test plan
npm testinserver/— 15/15 tests pass (node --test), including a realPOST /ocrrecognition ofdocs/assets/benchmark-generated-hello-123.png("HELLO 123", 98.9% confidence)docker build -f server/Dockerfile -t light-ocr-api .succeedsdocker run+curl /health,curl /info,curl -F image=@... /ocrall verified working against the built imagedocker stopverified graceful shutdown (exit code 0)🤖 Generated with Claude Code