fix(docker): worker HEALTHCHECK, align docling lab digest, lab pip cache
User description
Summary
Small Docker review items (a companion to #3642, the Compose safety PR).
- Dockerfile.worker: add a
HEALTHCHECKon/health. It resolves the port the same wayworker/health.tsdoes (WORKER_HEALTH_PORT, thenPORT). If neither is set, the health server is off, so the probe exits 1 with an explicit message instead of reporting healthy. Railway compatibility: Railway ignores DockerHEALTHCHECK(docs) and keeps gating deploys onrailway.worker.jsonhealthcheckPath: /healthonPORT. The appDockerfilealready ships aHEALTHCHECKthe same way. The instruction sits on one line becausetests/tsx-server-only-runner.test.tsreads the firstCMD-prefixed line as the entrypoint. - eval/docling/Dockerfile: pin the same
node:24-bookworm-slim@sha256:d6aa754f…digest asDockerfileandDockerfile.worker. The old pin was235600a8…. Both are valid multi-arch OCI indexes. - BuildKit cache mounts: added pip cache mounts only to the local docling lab image (
eval/docling/Dockerfile), where--require-hashesstill verifies every artifact. I did not add them toDockerfileorDockerfile.worker:tests/container-ci-contract.test.ts("keeps Railway Dockerfiles portable across service IDs") forbids--mount=type=cachethere, and I left that check as it is.
Areas touched: Delivery and assurance, Source intake and indexing
Verification
vitest runon container-ci-contract, docling-model-artifacts, worker-shadow-extraction, tsx-server-only-runner, sentry-release, railway-config, database-skills, ci-audit-contracts and worker-bundle →Test Files 9 passed (9) / Tests 202 passed (202)- I ran the healthcheck expression against a stub server.
WORKER_HEALTH_PORT→ exit 0;PORT→ exit 0; neither set → exit 1 with "worker health server disabled"; server down → exit 1 ci-change-scope→container_changed=true, so the required Docker image build and smoke run in CI. I couldn't build locally because the box has no Docker daemon.
Risk and rollout
- Risk: Low. The image gains a HEALTHCHECK, and Railway gating doesn't change. The lab image changes only its base digest and build cache.
- Rollback: Revert this PR.
- Provider or production effects: None.
Notes
- I didn't bump Trivy here, as requested. A future PR can update the Trivy version or action used by
scripts/trivy-image-scan.mjs.
Summary by cubic
Adds a container-runtime health probe to the worker image and aligns the docling lab image with the main Dockerfiles.
- Worker
HEALTHCHECKprobes/healthonWORKER_HEALTH_PORT, falling back toPORTlikeworker/health.ts; if neither is set it exits 1 with an explicit message instead of claiming healthy. docker-compose.ymlsetsWORKER_HEALTH_PORT: 8000for the health probe; no host port is exposed.- Railway ignores
HEALTHCHECKand keeps gating onrailway.worker.json, so deploy behavior is unchanged. - The lab image's
node:24-bookworm-slimpin now matches the digest used byDockerfileandDockerfile.worker. - BuildKit pip cache mounts speed up lab rebuilds;
--require-hashesstill verifies every artifact, andrun-lab.shnow requires a BuildKit builder. The Railway images intentionally keep cache mounts out percontainer-ci-contract.test.ts. - The healthcheck stays on one line because
tsx-server-only-runner.test.tsreads the firstCMD-prefixed line as the entrypoint.
CodeAnt-AI Description
Add worker container health checks and speed up Docling lab rebuilds
What Changed
- Docker and Compose can now detect when the worker’s
/healthendpoint is unavailable; the probe reports unhealthy if no health port is configured. - Docling lab rebuilds reuse cached Python packages while still verifying dependencies.
- The Docling lab image now uses the same pinned base image as the application and worker images.
Impact
✅ Clearer worker container health status
✅ Faster Docling lab rebuilds
✅ Consistent base image across containers
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by Gitar
- Compose configuration:
- Set
WORKER_HEALTH_PORT: 8000on the worker service indocker-compose.ymlfor the internal health listener
- Set
This will update automatically on new commits.
Summary by CodeRabbit
- Reliability
- Added Docker health monitoring for the worker, using its configured health-check port and reporting unhealthy when the endpoint is unavailable or returns an error.
- Developer Tools
- The document-processing benchmark now checks for a working Docker Buildx builder before building and enables BuildKit for the build.
- Improved dependency installation caching in the benchmark image build to help speed up repeated builds.