feat: extract OCR worker into separate service

- Remove Python/OCR steps from backend.Dockerfile (builder + runtime)
- Remove Python/OCR steps from backend-dev.Dockerfile
- Add OCR_BASE_URL env var to both Dockerfiles (http://ocr-worker:8100)
- Add ocr-worker service to docker-compose.yml with healthcheck
- Add ocr-worker service to docker-compose.dev.yml with healthcheck + port
- Update backend depends_on in both compose files to include ocr-worker
- Replace OCR_PROJECT_ROOT with OCR_BASE_URL in compose env vars
- Remove pip install line from start-dev-container.sh
This commit is contained in:
yml
2026-05-19 23:06:15 +08:00
parent f87238b6c0
commit b7de22d665
5 changed files with 42 additions and 30 deletions
+19 -1
View File
@@ -21,6 +21,22 @@ services:
volumes:
- postgres_dev_data:/var/lib/postgresql/data
ocr-worker:
build:
context: .
dockerfile: deploy/docker/ocr-worker.Dockerfile
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8100/health || exit 1"]
interval: 5s
timeout: 5s
retries: 20
start_period: 15s
environment:
TZ: ${TZ:-Asia/Shanghai}
ports:
- "${OCR_PORT:-8100}:8100"
backend:
build:
context: .
@@ -33,6 +49,8 @@ services:
depends_on:
postgres:
condition: service_healthy
ocr-worker:
condition: service_healthy
healthcheck:
test:
["CMD-SHELL", "curl -fsS http://127.0.0.1:3000/health/ready || exit 1"]
@@ -46,7 +64,7 @@ services:
DATABASE_URL: ${DATABASE_URL:-postgres://postgres:postgres@postgres:5432/order_site}
DATABASE_SSL: ${DATABASE_SSL:-false}
DATABASE_MAX_CONNECTIONS: ${DATABASE_MAX_CONNECTIONS:-10}
OCR_PROJECT_ROOT: /app/subservices/ocr-worker
OCR_BASE_URL: http://ocr-worker:8100
CLAIM_BASE_URL: ${CLAIM_BASE_URL:-http://localhost/#/claim}
TENCENT_REDEEM_PROOF_MODE: ${TENCENT_REDEEM_PROOF_MODE:-full}
TENCENT_BROWSER_HEADLESS: ${TENCENT_BROWSER_HEADLESS:-true}