Skip to content

allow docker build - to accept a context tar from stdin#5715

Merged
vieux merged 1 commit intomoby:masterfrom
proppy:context-tar
Jun 23, 2014
Merged

allow docker build - to accept a context tar from stdin#5715
vieux merged 1 commit intomoby:masterfrom
proppy:context-tar

Conversation

@proppy
Copy link
Contributor

@proppy proppy commented May 9, 2014

This allow things like docker build -t builder ; (docker run builder | docker build -t runner -)

@shykes
Copy link
Contributor

shykes commented May 10, 2014

That's cool, but won't this conflict with the current behavior of docker build -,
which reads a raw Dockerfile from stdin, then places it in an empty context and
builds that?

How would you see these 2 behaviors co-existing?

@shykes
Copy link
Contributor

shykes commented May 10, 2014

Also check out integration-cli/docker_utils.go there are bunch of utility functions
which can make your test much shorter and more readable :)

@proppy
Copy link
Contributor Author

proppy commented May 10, 2014

@shykes they are already coexisting, it bufio.Peek stdin to detect if it's compressed or not using a slightly refactored archive module.

See proppy@7457af7

If it's Uncompressed that's a Dockerfile.

@proppy
Copy link
Contributor Author

proppy commented May 10, 2014

About docker_utils.go: I can only use it for the last Command.Run.

I need access to the Command struct otherwise to specify the working directory, and pipe stdout.

@proppy
Copy link
Contributor Author

proppy commented May 10, 2014

added docs, PTAL

@proppy
Copy link
Contributor Author

proppy commented May 10, 2014

Fixed Docs, PTAL

@proppy
Copy link
Contributor Author

proppy commented May 13, 2014

Fixed docs, PTAL.

@SvenDowideit
Copy link
Contributor

nice.

Docs LGTM

@creack
Copy link
Contributor

creack commented May 13, 2014

@proppy Didn't you see any performance issue with bufio? I originally didn't use it because it slowed down a lot commit.

@proppy
Copy link
Contributor Author

proppy commented May 15, 2014

@creack PTAL removed the bufio stuff from archive

@unclejack
Copy link
Contributor

@proppy Could you rebase interactively and not add it in the first place, please?

@proppy
Copy link
Contributor Author

proppy commented May 15, 2014

@unclejack Done, PTAL

@proppy
Copy link
Contributor Author

proppy commented May 15, 2014

@unclejack PTAL cleaned up the history.

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs an empty line at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. PTAL

@unclejack
Copy link
Contributor

@proppy Could you also add tests for piping in uncompressed tarballs and piping in a Dockerfile, please?

Copy link
Contributor

Choose a reason for hiding this comment

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

This would detect uncompressed tarballs as a Dockerfile. You need to make any necessary adjustments to the length of the magic to make it work for uncompressed tarballs and do something like if archive.DetectCompression(magic) == archive.Uncompressed && !archive.IsTarball(magic) { while taking the sizing of the required magic into account for each function.

@proppy
Copy link
Contributor Author

proppy commented May 16, 2014

@unclejack Done, PTAL

@unclejack
Copy link
Contributor

@proppy Can you rebase this PR one more time, please?

@proppy
Copy link
Contributor Author

proppy commented Jun 2, 2014

@unclejack squashed and rebased

+ go test -run ^TestContext github.com/dotcloud/docker/integration-cli
[PASSED]: build - build an image with a context tar, compression: 2
[PASSED]: build - build an image with a context tar, compression: 0

@unclejack
Copy link
Contributor

LGTM

@proppy
Copy link
Contributor Author

proppy commented Jun 23, 2014

ping @vieux

@proppy
Copy link
Contributor Author

proppy commented Jun 23, 2014

rebased

Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
@vieux
Copy link
Contributor

vieux commented Jun 23, 2014

LGTM

1 similar comment
@tiborvass
Copy link
Contributor

LGTM

vieux added a commit that referenced this pull request Jun 23, 2014
allow docker build - to accept a context tar from stdin
@vieux vieux merged commit 2d195fb into moby:master Jun 23, 2014
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.

7 participants