Files
broker/Dockerfile
T
coreci da15bda6d2 docs(milestone): complete cli-packaging
---ci---
phase: 3
milestone: v0.2
status: complete
requirements:
  covered: [REQ-21, REQ-22, REQ-23]
  partial: []
---/ci---
2026-10-11 00:32:26 +00:00

42 lines
2.0 KiB
Docker

# coreci-broker docker image (v0.2, REQ-23).
#
# Equivalence mapping to the daemonless-published image
# (scripts/publish_image.py — the pipeline's source of truth):
# same base family: python:3.11-slim (D-022 pinned minor)
# same artifact: coreci_broker.py + coreci_broker_client.py +
# coreci_broker_ui/ + cli/__main__.py + _cli_version.py,
# packed by the same `python3 -m zipapp` invocation
# (--python "/usr/bin/env python3" --compress)
# same entrypoint: ["python3", "/app/coreci-broker.pyz"]
# same state anchor: WORKDIR /state (volume-backed; first boot generates
# .env, broker.db, broker.audit.log there)
# Documented differences (equivalence required, byte-identity NOT):
# - docker-build layering (COPY + RUN) vs the daemonless client's
# verbatim base layers + one deterministic broker layer
# - version provenance: ARG VERSION here vs build-time _cli_version.py
# injection in scripts/build_cli.py
# - no normalize pass here (docker rebuilds are not digest-pinned)
FROM python:3.11-slim
# Staging mirrors scripts/build_cli.py EXACTLY (P3-03, CWE-636): Docker
# copies directory CONTENTS flattened, so the staging layout must come
# from the destination paths — root sources at /app/src/, UI pages under
# /app/src/coreci_broker_ui/ (cli/__main__.py:80-83 materializes only
# coreci_broker_ui/* members; a flattened copy leaves /ui/* 404ing), and
# the shim staged as the archive-root __main__.py (zipapp boots the
# root __main__.py; the file-to-file rename mirrors build_cli's
# STAGED_SHIM staging).
COPY coreci_broker.py coreci_broker_client.py /app/src/
COPY coreci_broker_ui/ /app/src/coreci_broker_ui/
COPY cli/__main__.py /app/src/__main__.py
ARG VERSION=dev
RUN printf 'VERSION = "%s"\n' "$VERSION" > /app/src/_cli_version.py \
&& python3 -m zipapp /app/src -o /app/coreci-broker.pyz \
--python "/usr/bin/env python3" --compress
WORKDIR /state
ENTRYPOINT ["python3", "/app/coreci-broker.pyz"]
EXPOSE 8765