Skip to content

feat(docker): Add stream_progress_to parameter to DockerImage#21121

Open
wavebyrd wants to merge 9436 commits intoPrefectHQ:mainfrom
wavebyrd:fix/stream-docker-build-output
Open

feat(docker): Add stream_progress_to parameter to DockerImage#21121
wavebyrd wants to merge 9436 commits intoPrefectHQ:mainfrom
wavebyrd:fix/stream-docker-build-output

Conversation

@wavebyrd
Copy link

Summary

  • Adds stream_progress_to parameter to DockerImage class
  • Allows users to stream docker build and push output to stdout or any other TextIO stream
  • By default, output is suppressed (existing behavior unchanged)

Changes

  • Added stream_progress_to: Optional[TextIO] parameter to DockerImage.__init__
  • Pass it through to build_image() which already supports streaming
  • Added streaming support to push() method as well
  • Updated docstring to document the new parameter

Example usage

import sys
from prefect.docker import DockerImage

# Stream build and push output to stdout
image = DockerImage(name="my-image", stream_progress_to=sys.stdout)
image.build()  # Build output will be streamed to stdout
image.push()   # Push output will be streamed to stdout

Test plan

  • Create a DockerImage with stream_progress_to=sys.stdout and verify build output is streamed
  • Create a DockerImage without stream_progress_to and verify output is suppressed (default)
  • Verify push output streaming works correctly

Closes #18393

🤖 Generated with Claude Code

devin-ai-integration bot and others added 30 commits February 17, 2026 12:25
…efectHQ#20718)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…#20716)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…#20720)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…fectHQ#20692)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Nate Nowack <[email protected]>
…refectHQ#20725)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…age E2E tests (PrefectHQ#20726)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…0727)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…ctHQ#20730)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…refectHQ#20653)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… link E2E tests (PrefectHQ#20737)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…` field for programmatic resume (PrefectHQ#20741)

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
…fectHQ#20744)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Nate Nowack <[email protected]>
…trator` (PrefectHQ#20757)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
…#20761)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
desertaxle and others added 21 commits March 11, 2026 08:45
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…refectHQ#21086)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Nate Nowack <[email protected]>
…21085)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Alexander Streed <[email protected]>
Co-authored-by: alex.s <[email protected]>
…1090)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: alex.s <[email protected]>
Co-authored-by: alex.s <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: alex.s <[email protected]>
Co-authored-by: alex.s <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: bot_apk <[email protected]>
This allows users to stream docker build and push output to stdout
or any other TextIO stream. By default, output is suppressed, but
users can pass sys.stdout to see the build progress.

Example usage:
    image = DockerImage(name="my-image", stream_progress_to=sys.stdout)
    image.build()  # Build output will be streamed to stdout
    image.push()   # Push output will be streamed to stdout

Closes PrefectHQ#18393

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions github-actions bot added enhancement An improvement of an existing feature upstream dependency An upstream issue caused by a bug in one of our dependencies migration labels Mar 13, 2026
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wavebyrd please rebase this PR so that it includes only the changes described in the PR description.

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

Labels

enhancement An improvement of an existing feature migration upstream dependency An upstream issue caused by a bug in one of our dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream docker build to stdout