Skip to content

operations.docker: add compose, login/logout, and build operations#1675

Open
wowi42 wants to merge 8 commits intopyinfra-dev:3.xfrom
KalvadTech:feat/docker-compose-login-build
Open

operations.docker: add compose, login/logout, and build operations#1675
wowi42 wants to merge 8 commits intopyinfra-dev:3.xfrom
KalvadTech:feat/docker-compose-login-build

Conversation

@wowi42
Copy link
Copy Markdown
Collaborator

@wowi42 wowi42 commented Apr 20, 2026

Summary

  • Adds three new docker operations in one place, since they share design (flag assembly, DockerImage/DockerAuths-based idempotency) and it's easier to review together.
  • docker.compose: run docker compose up -d / down against an on-host compose file, with support for --project-name, --pull, --build, --force-recreate, --remove-orphans, and -v. Not idempotent from pyinfra's side; Docker's own layer/state handling keeps re-runs cheap.
  • docker.login / docker.logout: idempotent registry auth. Checks ${DOCKER_CONFIG:-~/.docker}/config.json via a new DockerAuths fact; login pipes the password to --password-stdin and masks it in logs.
  • docker.build: wraps docker build (or docker buildx build via builder=). Supports tags, dockerfile, build_args, labels, target, platform, network, cache_from, secrets, pull, no_cache, and tag-based idempotency (no-op when every declared tag already exists locally, unless force=True).

Supersedes #1674 and #1673.

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

@DonDebonair
Copy link
Copy Markdown
Collaborator

I honestly disagree that adding all 3 (compose, login/logout, build) in 1 PR makes it easier to review. I might be dumb, but I like focused PRs that are as small as possible so the context is manageable.

Could you split it into 3 PR @wowi42 ?

I love the additions btw!

@wowi42
Copy link
Copy Markdown
Collaborator Author

wowi42 commented Apr 24, 2026

Split this PR into three focused PRs, each freshly based on current 3.x:

Happy to close this one in favour of the three above — let me know if you'd prefer to keep it open for context.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker Repozitory Operations?

2 participants