Commit Graph

48 Commits (b0d37376274788db03d9d7f69089dc938b95eaa7)

Author SHA1 Message Date
Jörg Franke 5f23bdf9d0 Expand chown value of ADD command
Signed-off-by: Jörg Franke <359489+NewJorg@users.noreply.github.com>
2020-05-02 19:37:23 +02:00
Tonis Tiigi 4b2636acca dockerfile: add more source information to errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-21 23:46:17 -07:00
Tonis Tiigi bb484dcce3 dockerfile: remove IsUnknownInstruction
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-21 10:44:24 -07:00
Tonis Tiigi e2835e55ad dockerfile: store error location in instructions parser
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-19 20:56:31 -07:00
Tonis Tiigi 37b8832d00 upgrade errors checks to Is()
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-18 22:53:38 -07:00
Tonis Tiigi c157d8a3ef dockerfile: remove mix of testing frameworks
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-14 22:05:41 -07:00
Sebastiaan van Stijn 2105de3499
frontend/dockerfile: show original stagename in error-message
Before this change, the error message would show the invalid name in lowercase:

    docker build -<<'EOF'
    FROM busybox AS foo:$BAR
    EOF

    [+] Building 0.2s (2/2) FINISHED
    => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                                             0.0s
    => => transferring dockerfile: 67B                                                                                                                                                                                                                                                                                                                              0.0s
    => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                0.1s
    => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                  0.0s
    failed to solve with frontend dockerfile.v0: failed to create LLB definition: Dockerfile parse error line 1: invalid name for build stage: "foo:$bar", name can't start with a number or contain symbols

With this patch, the invalid stagename is shown as-is

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-26 13:50:40 +01:00
Andy Caldwell 588c07f9b4
Set RunOptions rather than modifying solve state
Signed-off-by: Andy Caldwell <andrew.caldwell@metaswitch.com>
2019-08-18 21:45:47 +01:00
Andy Caldwell 5ea3a003f7
Implement support for RUN --network=none|default|host
Signed-off-by: Andy Caldwell <andrew.caldwell@metaswitch.com>
2019-08-17 01:44:46 +01:00
Tonis Tiigi 1ac116289d dockerfile: allow required key only for secret/ssh mounts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-07-29 15:47:54 -07:00
Tonis Tiigi add2c8db8a dockerfile: allow required flag to take value
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-07-26 16:54:20 -07:00
Andrey Smirnov 86e19b621e Implement frontend support for RUN --security=insecure
Example:

    RUN --security=insecure cat /proc/self/status | grep CapEff
    #84 0.093 CapEff:	0000003fffffffff

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-07-19 01:01:42 +03:00
Tonis Tiigi aed5e98d92 dockerfile: allow uid/gid in cache mounts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-05-22 11:20:15 -07:00
Hao Hu 0248635269 Expand chown value of COPY command
Signed-off-by: Hao Hu <hao.hu.fr@gmail.com>
2019-04-06 10:53:05 +02:00
Tonis Tiigi 502de0e0b4 dockerfile: make tmpfs mount readwrite by default
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-04-02 18:14:52 -07:00
Tonis Tiigi 2529762ae7 dockerfile: allow setting file mode/uid for ssh socket
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-01-03 11:13:34 -08:00
Tonis Tiigi 12513ba394 dockerfile: remove dfextall build tag
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-10-15 22:27:13 -07:00
Tonis Tiigi 079b429c12 dockerfile: fix ssh required option
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-10-05 14:10:09 -07:00
Akihiro Suda fa92effc4b dockerfile: add support for RUN --mount=type=ssh
* Needs to be compiled with `dfrunmount dfssh`
* Implemented options:
 * `type`(required): needs to be `ssh`
 * `target`(optional): the socket path in the container
 * `id`(optional): id

Test script:

	#!/bin/bash
	set -exu -o pipefail
	REF=localhost:5000/dfssh:latest
	ssh-add -l
	sudo buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=frontend/dockerfile/cmd/dockerfile-frontend \
	  --frontend-opt "build-arg:BUILDTAGS=dfrunmount dfssh" \
	  --exporter=image --exporter-opt name=$REF --exporter-opt push=true
	mkdir -p /tmp/foo
	cd /tmp/foo
	cat << EOF > Dockerfile
	# syntax=$REF
	FROM alpine
	RUN apk add --no-cache openssh-client
	RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
	RUN --mount=type=ssh ssh git@gitlab.com
	# "Welcome to GitLab, @GITLAB_USERNAME_ASSOCIATED_WITH_SSHKEY" should be printed here
	EOF
	sudo buildctl build --ssh default=$SSH_AUTH_SOCK --progress=plain --frontend=dockerfile.v0 --local context=. --local dockerfile=.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-10-03 14:53:43 +09:00
Tonis Tiigi d40d557692 dockerfile: fix building dfextall
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-10-02 10:33:18 -07:00
Tonis Tiigi 6daf696f04 dockerfile: add required option for secrets
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-08-28 16:18:08 -07:00
Tonis Tiigi 5e6729e56f dockerfile: implement secret type mounts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-08-08 18:12:16 -07:00
Yuichiro Kaneko 93e3b15854 `s/docker file/Dockerfile/`
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-19 07:38:58 +09:00
Yuichiro Kaneko ee15340993 Add a description about metaArgs return value
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-18 22:32:15 +09:00
Yuichiro Kaneko c641b43e4a Use simple `KeyValuePairOptional` to `dispatchOpt.metaArgs` and `dispatchState.buildArgs`
`KeyValuePairOptional` is enough in this case. We can avoid create `ArgCommand` out of Parser
 by replacing them with `KeyValuePairOptional`.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-10 19:24:43 +09:00
Yuichiro Kaneko ec798d6b09 Update documents of `AddCommand`
`ADD` does not support git.

Ref: https://github.com/moby/moby/issues/14704#issuecomment-298134333

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-03 09:25:30 +09:00
Yuichiro Kaneko a448c8f3fb Fix a typo
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-06-30 11:20:33 +09:00
Tonis Tiigi e618878451 dockerfile: platform support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-25 11:06:08 -07:00
Tonis Tiigi cdcab49bfc dockerfile: expose cache sharing options
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-19 15:57:25 -07:00
Vincent Demeester 79241f25d5
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-11 15:52:17 +02:00
Tonis Tiigi 6f569455d0 dockerfile: enable tmpfs mounts on run —mount
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-08 13:42:38 -07:00
Tonis Tiigi af03a526e7 dockerfile: run -—mount initial support
Supports binds from images and context and cache mounts.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-07 16:23:40 -07:00
Tonis Tiigi aeea615e85 dockerfile: add run mount parsing
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-07 14:55:13 -07:00
Tonis Tiigi 76d15da0d5 dockerfile: update imports
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-01 20:10:18 -07:00
Sebastiaan van Stijn 9dc3c39c2c Various code-cleanup
remove unnescessary import aliases, brackets, and so on.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

rewritten from github.com/moby/moby f23c00d8701e4bd0f2372a586dacbf66a26f9a51
2018-06-01 20:10:13 -07:00
Sebastiaan van Stijn 5d7a878e53 Replace deprecated testutil.ErrorContains()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

rewritten from github.com/moby/moby 55bebbaecf5e40db9d83b28080ce08dc8642f407
2018-06-01 20:10:13 -07:00
Dennis Chen c35701d68d Add 'LABEL' command from '--label' to the last stage
This PR is tring to fix issue #36996.

Currently for multi-stage build, if `--target` specified, the `--label` option
will be ignored. The root cause is the last stage build will remove the `LABEL`
command(s) node created from the `--label` option. In order to address this issue,
we can create `LABEL` command(s) and add it/tem to the last stage.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>

rewritten from github.com/moby/moby 9c238ebd55e4105ad7f7edc04231ea61bb278ae8
2018-06-01 20:10:13 -07:00
Dennis Chen 29887cc5b2 Fix the target name issue for multi-stage build
This PR is trying to fix issue #36956.

The stage name is case-insensitive by design, so we should use
`strings.EqualFold()` as the comparison method to eliminate the
case sensitive noise.

Also we need to return a pre-defined error code order to avoid below
message like:
"FIXME: Got an API for which error does not match any expected type!!!:
failed to reach build target dev in Dockerfile"

Signed-off-by: Dennis Chen <dennis.chen@arm.com>

rewritten from github.com/moby/moby 7c0570473cfa181aeb3278072cc9af4f9298cb98
2018-06-01 20:10:13 -07:00
John Howard 668e4abfbb Builder: Review feedback
Signed-off-by: John Howard <jhoward@microsoft.com>

rewritten from github.com/moby/moby 14429056d3745ca052fba448d879788d16bbb01b
2018-06-01 20:10:13 -07:00
John Howard 354aaeb223 Builder: Plumbing through platform in `FROM` statement
Signed-off-by: John Howard <jhoward@microsoft.com>

rewritten from github.com/moby/moby 69fa84bc3d57dafd19800642c5ba196bc6d45f90
2018-06-01 20:10:13 -07:00
John Howard 0381374837 Builder - add --platform to FROM statement
Signed-off-by: John Howard <jhoward@microsoft.com>

rewritten from github.com/moby/moby 7f0c2d23e11485c7f026dd8c111c60c2e1e03375
2018-06-01 20:10:13 -07:00
Daniel Nephin 3b28b903b9 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>

rewritten from github.com/moby/moby 6be0f709830113966f295401327b027ec2f0bbca
2018-06-01 20:10:13 -07:00
bin liu 0873a108bb Fix typos in builder and client
Signed-off-by: bin liu <liubin0329@gmail.com>

rewritten from github.com/moby/moby ce0993270436c16a17e0afb08b9130556346b983
2018-06-01 20:10:13 -07:00
Daniel Nephin a3b7488b81 Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>

rewritten from github.com/moby/moby 4f0d95fa6ee7f865597c03b9e63702cdcb0f7067
2018-06-01 20:10:13 -07:00
Ri Xu 182b2d5bd6 Typo fixed and simple code.
Signed-off-by: Ri Xu <xuri@360.net>

rewritten from github.com/moby/moby 87e8a936e82ecfbef59b829d8bbfca3fb4aa3163
2018-06-01 20:10:13 -07:00
John Howard ff49463d78 Fix TestErrorCases to run all tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>

rewritten from github.com/moby/moby d2c41f06c36dc24b2170fef365563d64cc5bd8ec
2018-06-01 20:10:13 -07:00
Sebastiaan van Stijn 3b355e7083 Improve error message for COPY missing destination
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

rewritten from github.com/moby/moby 5d05a8291314b8f727b04b504b8d7fc7ed7f42da
2018-06-01 20:10:13 -07:00
Simon Ferquel 8cde317b4c Introduce a typed command system and 2 phase parse/dispatch build
This is a work base to introduce more features like build time
dockerfile optimisations, dependency analysis and parallel build, as
well as a first step to go from a dispatch-inline process to a
frontend+backend process.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>

rewritten from github.com/moby/moby 669c0677980b04bcbf871bb7c2d9f07caccfd42b
2018-06-01 20:10:13 -07:00