Skip to content

[T-005a] Backend container image (multi-stage, uv, non-root) #26

Closed

Description

@CodewithJha

Task T-005a · Milestone M1 — Foundation · Size S · Priority P1 · Epic #1

Implements NFR-DEP-002 · NFR-SEC-002

Branch ci/t-005a-backend-container-image-multi-stage — one task = one branch = one PR (doc 32 §6)

Summary

Create docker/backend.Dockerfile producing one image used for migrate, api, orchestrator and worker-k2d services.

Context / motivation

One image for every environment, configured only via env/secret files (NFR-DEP-002), is the basis of make up and the release flow.

Scope

In scope

  • Multi-stage build: builder with uv sync --locked --no-dev --extra api --extra worker --extra ml, runtime python:3.12-slim (digest-pinned).
  • Non-root user roboprobe (uid 10001), WORKDIR /app, /data/artifacts volume mount point.
  • ENTRYPOINT ["roboprobe"]; no default command (compose chooses).
  • OCI labels (source, revision, version) via build args.
  • .dockerignore.

Implementation guidance

  • Use --mount=type=cache,target=/root/.cache/uv. CPU-only torch wheels (index from T-001). Keep image small: no compilers in runtime stage. HEALTHCHECK defined per service in compose, not in the image.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • docker build -f docker/backend.Dockerfile . succeeds; docker run --rm <img> --version prints the version.
  • Container runs as non-root (id -u ≠ 0).
  • Image has no secrets baked in (checked with docker history).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • CI smoke step (added in T-119) runs --version; local verification noted in PR.

Dependencies

Blocked by: #12 (T-001)

Blocks: #27 (T-005b), #189 (T-119), #58 (T-090)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • docker/backend.Dockerfile
  • .dockerignore

Independent of T-005b until compose references the image.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-005a (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 17 §5 · doc 21 §1 · ADR-0013

Requirements: NFR-DEP-002 · NFR-SEC-002 (traceability: doc 28)

External:

Activity

  1. added this to the M1 — Foundation milestone on Nov 19, 2026
  2. added
    type:infraCI, build, deployment infrastructure
    area:deployDocker images, compose, release packaging
    priority:P1Required for milestone exit
    taskChild task of a milestone epic
    on Nov 19, 2026
  3. CodewithJha commented on Nov 19, 2026

    @CodewithJha
    OwnerAuthor

    Implemented in #244.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:deployDocker images, compose, release packagingmilestone:M1M1 — Foundationpriority:P1Required for milestone exitsize:S<= 1 daytaskChild task of a milestone epictype:infraCI, build, deployment infrastructure

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions