docker.staging¶
File staging onto a parent host.
Building an image and running docker compose both require getting the
relevant files (Dockerfile, build context, compose YAML) onto the parent
host that runs the docker daemon. This module wraps that with a small,
predictable layout under /tmp/otto-docker/<project>/ on the parent.
Layout:
/tmp/otto-docker/<project>/
build/<image>/<context-as-tar> # extracted build context
compose/<n>/<basename>.yml # one numbered dir per compose file
Cleanup is the caller’s responsibility (and is best-effort: a previous crash is recovered from on the next stage). The directory layout is stable across runs so nothing leaks into per-invocation subdirs.
- otto.docker.staging.project_root(project)¶
Per-project staging root on the parent host.
- Return type:¶
Path
- otto.docker.staging.image_build_dir(project, image_name)¶
Where this image’s context will live on the parent.
- Return type:¶
Path
- async otto.docker.staging.stage_image_context(parent, project, image)¶
Tar the build context locally, ship it to the parent, untar it.
Returns the absolute path on the parent of the extracted context directory. The Dockerfile is included verbatim under its declared name so
docker build -fresolves it.- Return type:¶
Path
- async otto.docker.staging.stage_compose_files(parent, project, composes)¶
Copy compose files to numbered directories on the parent.
Numbered directories preserve the order the project listed them (which determines override precedence in
docker compose -f a -f b). Returns the absolute paths on the parent in the same order.- Return type:¶
list[Path]