Commit Graph

29 Commits

Author SHA1 Message Date
Ahmet Alp Balkan ccde3a1f73 Create builder/command, cut libcontainer dependency on integration-cli
d1e9d07c introduces a dependency to libcontainer and other daemon
related packages through builder package. The only thing test needs
is set of the Dockerfile commands. Extracting them to a separate
package.

This was causing CI tests to not to compile on non-Linux platforms.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-11 21:44:31 -08:00
Doug Davis 1654dfdf14 Show err msg on empty 'scratch' Dockerfile
If you have a Dockefile with just:
   FROM scratch

An error is generated but its never shown to the CLI. This PR fixes that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-10 11:43:45 -08:00
Doug Davis d1e9d07c1b Get list of Dockerfile cmds from builder so we can be smarted in our tests
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-08 08:09:02 -08:00
Doug Davis e4f02abb51 Add support for no-arg commands in Dockerfile
We're hoping to add some new commands that don't have any args so this
PR will enable that by removing all of the hard-coded checks that require
commands to have at least one arg.  It also adds some checks to each
command so we're consistent in the error message we get.  Added a test
for this too.

We actually had this check in at least 3 different places (twice in the
parser and once in most cmds), this removes 2 of them (the parser ones).

Had to remove/modify some testcases because its now legal to have certain
commands w/o args - e.g. RUN. This was actually inconsistent because
we used to allow "RUN []" but not "RUN" even though they would generate
(almost) the same net result.  Now we're consistent.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-08 03:36:49 -08:00
Tibor Vass 73d5baf585 builder: prevent Dockerfile to leave build context
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2015-02-02 23:40:24 -08:00
Doug Davis 198ff76de5 Add an API test for docker build -f Dockerfile
I noticed that while we have tests to make sure that people don't
specify a Dockerfile (via -f) that's outside of the build context
when using the docker cli, we don't check on the server side to make
sure that API users have the same check done. This would be a security
risk.

While in there I had to add a new util func for the tests to allow us to
send content to the server that isn't json encoded - in this case a tarball

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-02 23:40:20 -08:00
Doug Davis eb3ea3b43c Allow for Dockerfile to be named something else.
Add a check to make sure Dockerfile is in the build context
Add docs and a testcase
Make -f relative to current dir, not build context

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 16:33:26 -08:00
Doug Davis 6d801a3caa Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 10:57:48 -08:00
Josh Hawn 8936789919 Make `FROM scratch` a special cased 'no-base' spec
There has been a lot of discussion (issues 4242 and 5262) about making
`FROM scratch` either a special case or making `FROM` optional, implying
starting from an empty file system.

This patch makes the build command `FROM scratch` special cased from now on
and if used does not pull/set the the initial layer of the build to the ancient
image ID (511136ea..) but instead marks the build as having no base image. The
next command in the dockerfile will create an image with a parent image ID of "".
This means every image ever can now use one fewer layer!

This also makes the image name `scratch` a reserved name by the TagStore. You
will not be able to tag an image with this name from now on. If any users
currently have an image tagged as `scratch`, they will still be able to use that
image, but will not be able to tag a new image with that name.

Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158',
it was nice knowing you.

Fixes #4242

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-18 14:03:38 -08:00
Arnaud Porterie a76f7c6ec3 Merge pull request #9122 from dqminh/debug-huge-expose
Expose a large number of ports should not slow down builder
2014-12-16 10:03:31 -08:00
unclejack 054e57a622 build: add pull flag to force image pulling
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-11-21 19:59:44 +02:00
Daniel, Dao Quang Minh 3aae63f452 speed up creation of args and msg for huge cmds
Whenever a command arguments is formed by a large linked list, repeatedly
appending to arguments and displayed messages took a long time because go will
have to allocate/copy a lot of times.

This speeds up the allocation by preallocate arrays of correct size for args
and msg

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-11-12 00:04:45 -05:00
Erik Hollensbe 4e74cd498b builder: whitelist verbs useful for environment replacement.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-27 17:38:25 +00:00
Jessie Frazelle 15b6b7be01 Merge pull request #8770 from LK4D4/logrus_support
Logrus support
2014-10-27 09:05:24 -07:00
Alexandr Morozov 7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Erik Hollensbe cdd6e97910 builder: some small fixups + fix a bug where empty entrypoints would not override inheritance.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-24 00:23:25 +00:00
Erik Hollensbe 1150c1639a builder: ONBUILD triggers were not accurately being executed in JSON cases.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-14 01:59:45 +00:00
Tibor Vass 0a2c481c7f ignore invalid Dockerfile instructions and do not consider "docker-version" a Dockerfile instruction
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-10-06 23:26:59 -04:00
Erik Hollensbe 1e93639aed builder: Appropriately initialize the Cmd in runconfig.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-09-22 23:10:05 -07:00
unclejack 31c0039022 clean up the context when a build fails
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-15 16:01:23 +03:00
Tibor Vass 23f490427f Merge pull request #7983 from vbatts/vbatts-tarsum_switch_names
tarsum: TarSum should be the interface
2014-09-12 17:01:35 -04:00
Erik Hollensbe 92f885d7bd Do not populate path to prevent runconfig merge conflict; remove
autoConfig seeding of entrypoint.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-09-11 06:00:24 -07:00
Erik Hollensbe ac107995ae builder: Fix entrypoint and cmd semantics in evaluator. Test c/o @cnf
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-09-11 06:00:24 -07:00
Vincent Batts ec01eb653d tarsum: TarSum is not the interface
don't export the exsisting TarSum struct and call the interface 'TarSum'
instead.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-09-10 21:56:20 -04:00
Vincent Batts 747f89cd32 TarSum: versioning
This introduces Versions for TarSum checksums.
Fixes: https://github.com/docker/docker/issues/7526

It preserves current functionality and abstracts the interface for
future flexibility of hashing algorithms. As a POC, the VersionDev
Tarsum does not include the mtime in the checksum calculation, and would
solve https://github.com/docker/docker/issues/7387 though this is not a
settled Version is subject to change until a version number is assigned.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-09-10 15:41:52 -04:00
unclejack 1858746978 clean up context on build completion & add test
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-02 17:35:25 +03:00
Erik Hollensbe 2ef1dec7e8 builder: Refactors according to @tiborvass's comments
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-08-27 18:52:30 -07:00
Erik Hollensbe 305f735080 builder: several fixups from comments
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-08-27 18:52:30 -07:00
Erik Hollensbe a1522ec01c builder: move the evaluator package code directly into builder
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-08-27 18:52:30 -07:00