Files
pfm-ocr/backend/docker-compose.yml
T
Rafhan Mazaya FathurrahmanandClaude Sonnet 5 e60ab63154 Adopt agents-settings kit, ship Product/SKU scan models, harden auth, verify OCR accuracy
Backend (app-pfm-ocr-v2/backend):
- Product/SKU scan feature complete: trained DINOv2 index (118 reference
  photos, 16 SKU classes) and YOLO classifier (83.3% top-1 val accuracy),
  fixed scripts/install-pipeline.sh (was missing ultralytics/torch), fully
  browser-verified end-to-end on /scan-pfm. Mobile m-scan-pfm page cancelled
  (Flutter app handles mobile; web UI is desktop-only for pipeline testing).
- Fixed a real data-loss bug: Save Ground Truth (scan-pfm and the DO-flow's
  manual-label) was silently writing into the pfm-web-app container's
  ephemeral filesystem instead of the host, because /sources wasn't
  bind-mounted in docker-compose.yml. Added the mount, recovered an
  orphaned entry.
- accounts.password is now bcrypt-hashed (bcryptjs, idempotent migration
  in db/init.ts) instead of plaintext; login route compares hashes.
- /api/v1/documents/* (list, PUT, upload) now enforces real 401 auth,
  matching what the Flutter client already sends. The "classic" routes
  deliberately stay open — they're dev-only web UI with no login flow and
  won't exist in production.
- OCR accuracy investigated end-to-end: real baseline is 95.10% overall
  (target met; accuracy_report.md was stale at 75.04%, now flagged). Fixed
  one genuine parser.ts bug (SO/DO field duplication in the global fallback
  regex); remaining gaps are OCR/layout-model limitations, not parser bugs.
- Adopted a standalone copy of the fhanyuh/agents-settings e/n workflow
  scoped to backend/ (AGENTS.md Part A/B split, SKILLS.md, plans/, docs/),
  independent of the root copy which now covers Flutter only.
- next-implementation.md deleted; content folded into
  backend/plans/next-enhancements.md for traceability.

Root:
- Adopted fhanyuh/agents-settings kit (AGENTS.md, SKILLS.md, plans/,
  docs/feature-list.md), scoped to the Flutter app only.
- Pending documents queue now persists to Hive (lib/core/storage) instead
  of memory-only, surviving an app kill mid-upload.

Removed backend_backup/ (stale Express/Prisma prototype, superseded by
pfm-web-app) and the completed plans/next-enhancement-plan.md checklist.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 11:56:32 +07:00

147 lines
3.9 KiB
YAML

name: ai-ocr-pfm-2026
services:
nginx:
image: nginx:alpine
container_name: paddleocr-nginx
ports:
- "${APP_PORT:-8000}:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- vllm-server
- pipeline-api
- gradio-ui
- pfm-web-app
restart: unless-stopped
vllm-server:
build:
context: .
target: vllm-server
container_name: paddleocr-vllm-server
image: paddleocr-vllm-server:latest
environment:
- GENAI_HOST=0.0.0.0
- GENAI_PORT=8118
- GENAI_MODEL=${GENAI_MODEL:-PaddleOCR-VL-1.6-0.9B}
- GENAI_BACKEND=${GENAI_BACKEND:-vllm}
- VLLM_CONFIG=${VLLM_CONFIG:-config/vllm_config.yaml}
- CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0}
- PADDLE_PDX_DISABLE_MODEL_SOURCE_CHECK=True
# No exposed ports; internal only
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
- hf_cache:/root/.cache/huggingface
- paddle_cache:/root/.paddleocr
- paddlex_cache:/root/.paddlex
- ./config:/app/config
- ./.env:/app/.env:ro
restart: unless-stopped
pipeline-api:
build:
context: .
target: pipeline-api
container_name: paddleocr-pipeline-api-v10
image: paddleocr-pipeline-api:latest
environment:
- PIPELINE_CONFIG=${PIPELINE_CONFIG:-config/pipeline_config_vllm.yaml}
- PIPELINE_HOST=0.0.0.0
- PIPELINE_PORT=8090
- PIPELINE_DEVICE=gpu:0
- CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0}
- VLLM_SERVER_URL=http://paddleocr-pfm-web-app:3000/api/vllm-proxy/v1
- PADDLE_PDX_DISABLE_MODEL_SOURCE_CHECK=True
# No exposed ports; internal only
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
- paddle_cache:/root/.paddleocr
- paddlex_cache:/root/.paddlex
- ./config:/app/config
- ./pfm-web-app/public/produk-pfm/models:/app/pfm-web-app/public/produk-pfm/models:ro
- ./.env:/app/.env:ro
depends_on:
- vllm-server
restart: unless-stopped
gradio-ui:
build:
context: .
target: gradio-ui
container_name: paddleocr-gradio-ui
image: paddleocr-gradio-ui:latest
environment:
- API_URL=http://paddleocr-pipeline-api-v10:8090/layout-parsing
- GRADIO_PORT=7870
- GRADIO_MCP_SERVER=True
# No exposed ports; internal only
depends_on:
- pipeline-api
restart: unless-stopped
pfm-web-app:
build:
context: .
target: pfm-web-app
container_name: paddleocr-pfm-web-app
image: paddleocr-pfm-web-app:latest
command: npm run dev
environment:
- PIPELINE_URL=http://paddleocr-pipeline-api-v10:8090/layout-parsing
- NODE_ENV=development
- PGHOST=paddleocr-db
- PGPORT=5432
- PGUSER=postgres
- PGPASSWORD=postgres
- PGDATABASE=dopfm
- JWT_SECRET=${JWT_SECRET:-dev-only-insecure-secret-change-me}
pid: "host"
volumes:
- ./pfm-web-app:/app
- /app/node_modules
- /app/.next
- ./uploads:/uploads
- /var/run/docker.sock:/var/run/docker.sock
# No exposed ports; internal only
depends_on:
- pipeline-api
- db
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
db:
image: postgres:15-alpine
container_name: paddleocr-db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=dopfm
volumes:
- pgdata:/var/lib/postgresql/data
- ./db/migrations:/docker-entrypoint-initdb.d:ro
restart: unless-stopped
volumes:
hf_cache:
name: paddleocr_hf_cache
paddle_cache:
name: paddleocr_paddle_cache
paddlex_cache:
name: paddleocr_paddlex_cache
pgdata:
name: paddleocr_pgdata