Commit Graph

136 Commits (ea7a9146a294f210adba4156005ea6716c28ae24)

Author SHA1 Message Date
Tonis Tiigi 04a5cc81e8 dockerfile: add platform prefixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-31 10:41:36 -07:00
Tonis Tiigi d0aafaefd0 dockerfile: add stage prefixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-31 10:41:36 -07:00
Tonis Tiigi 4c44d2c6e4 dockerfile: custom names to vertexes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-31 10:41:30 -07:00
Tonis Tiigi 489246dd28 cache: support for internal/frontend record type
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-26 22:54:53 -07:00
Tonis Tiigi b966096ab5 dockerfile: allow setting image resolve mode
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-25 18:23:59 -07:00
Tonis Tiigi 9f5e5c7dc7 metaresolver: refactor to option struct and resolvemode
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-25 18:22:15 -07:00
Tonis Tiigi 6be1257f5d export: manifest list support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-25 16:01:12 -07:00
Tonis Tiigi 69bb8e8a15 dockerfile: allow automatic platform variables
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-07-25 16:01:05 -07:00
Yuichiro Kaneko 08a5847eff Split resolving platform codes to `buildPlatformOpt`
This will make it easy to test these functions.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-24 08:46:32 +09:00
Yuichiro Kaneko 85987b10ee Rename `toEnvList` to `toEnvMap`
Because `toEnvList` was changed to return map.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-21 08:30:47 +09:00
Yuichiro Kaneko 80e2176450 Omit needless argument `override`
It always called with `override = true`.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-20 19:46:50 +09:00
Yuichiro Kaneko 936aa64061 Use `ProcessWord(s)WithMap` to avoid string contatination and string split
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-20 19:41:15 +09:00
Yuichiro Kaneko 83dc829222 Extract parsing logic of "key=val" as `parseKeyValue`
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-19 21:36:07 +09:00
Yuichiro Kaneko fb499edc5b Omit needless argument `commit` from `dispatchEnv`
Always `dispatchEnv` is called `commit` with `true`.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-18 21:38:37 +09:00
Yuichiro Kaneko 5838f9e763 Simplify `State` setup
On this code `dispatchEnv` is called with `commit = false`,
so this call do these 2 things

* `AddEnv` to `d.state`
* `addEnv` to update `d.image.Config.Env`

But updating `d.image.Config.Env` has no effect on `d.image.Config.Env`
because this is in for-loop of `range d.image.Config.Env`.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-18 21:29:55 +09:00
Yuichiro Kaneko c9038a2f5d Use `ProcessWordWithMap` in simple cases
In the case when the second argument of `toEnvList` is `nil`,
we can use `ProcessWordWithMap` and avoid string contatination
and string split.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-18 08:54:18 +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 30c27cd6bf Return an error when copying from url
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-03 20:28:08 +09:00
Yuichiro Kaneko b8bf5d0da9 Refactoring `toCommand` and `detectRunMount` to only depend to `dispatchStates`
Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-03 07:38:34 +09:00
Yuichiro Kaneko 0d5c12363a Introduce `dispatchStates` type
`dispatchStates` manages a collection of `dispatchState`.
By `dispatchStates`, we can aggregate how to find `dispatchState`
in one place and `dispatchStatesByName` local variable in `Dockerfile2LLB`
can be removed.

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-07-03 07:36:07 +09:00
Tõnis Tiigi 3b9737dd5a
Merge pull request #470 from yui-knk/ensure_arg_is_not_blank
Ensure BaseName of Stage is not blank
2018-06-28 10:32:11 -07:00
Yuichiro Kaneko 813575f62a Ensure BaseName of Stage is not blank
Related: https://github.com/moby/moby/issues/37325

Signed-off-by: Yuichiro Kaneko <spiketeika@gmail.com>
2018-06-28 20:21:41 +09:00
Akihiro Suda cce2080ddb
Merge pull request #468 from tonistiigi/update-containerd
vendor: update containerd to 08f7ee982
2018-06-27 14:37:47 +09:00
Tonis Tiigi 97abda7528 dockerfile: use manifest list copy image
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-26 21:22:32 -07:00
Tonis Tiigi 65e6d4d21a dockerfile: allow autodetect platform from image config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-26 10:42:30 -07: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 f9383c48a3 source: image source platform support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-25 10:39:17 -07:00
Tonis Tiigi dc9de85069 llb: force platform in llb and allow constraints
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-22 16:49:03 -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
Tibor Vass eb44845441 dockerfile: update copy image to v0.1.3
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-06-09 02:49:34 +00:00
Akihiro Suda 60344aa592
Merge pull request #442 from tonistiigi/runmount
dockerfile: add run --mount support
2018-06-09 02:35:34 +09: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 103cd072d6 dockerfile: detect source symlinks with targets
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-06-05 23:54: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
Tibor Vass 9adfee1475 dockerfile: use updated tonistiigi/copy:v0.1.1 image
https://github.com/tonistiigi/copy/pull/3

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-05-24 20:57:45 +00:00
Tõnis Tiigi 6a103ab0ac
Merge pull request #403 from tonistiigi/modtime
Fixes for cache invalidation on modtime change
2018-05-24 13:51:50 -07:00
Tonis Tiigi 1fad598adf dockerfile: add withShell
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-23 12:19:10 -07:00
Tonis Tiigi 50386f3772 dockerfile: reset cmd from parent on entrypoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-23 12:18:14 -07:00
Tonis Tiigi eefc49ff72 dockerfile: detect empty images early
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-22 16:54:04 -07:00
Tonis Tiigi 53738b8211 dockerfile: allow ignorecache on copy
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-22 10:50:36 -07:00
Tonis Tiigi 286cf44db3 dockerfile: add default build-arg support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-21 16:08:12 -07:00
Akihiro Suda 199eb01177 dockerfile: fix `ADD https://.../foo.tar.gz /local/foo.tar.gz`
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-05-21 15:15:27 +09:00
Tonis Tiigi 1e096c4ce9 dockerfile: allow builds from http context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-16 23:03:52 -07:00
Akihiro Suda 80f113196d
Merge pull request #390 from tiborvass/fix-nil-labels-panic
dockerfile: ensure Labels map is not accessed when nil
2018-05-17 11:15:10 +09:00
Tibor Vass a2d2551dcd dockerfile: ensure Labels map is not accessed when nil
Signed-off-by: Tibor Vass <tibor@docker.com>
2018-05-17 01:30:19 +00:00
Tonis Tiigi a55d206cdb dockerfile: add no-cache support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-14 09:53:34 -07:00
Tonis Tiigi b8b55a8c22 image: export reproducible timestamps
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-04 15:51:19 -07:00
Tonis Tiigi f9d1e4c32c dockerfile: add test for labels
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-05-03 16:24:26 -07:00
Tonis Tiigi 864adf02dd dockerfile: fix context path detection for var substitution
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-04-23 11:37:53 -07:00
Tonis Tiigi 8b85812dda dockerfile: allow skipping resolving manifest
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-04-19 21:39:58 -07:00
Tonis Tiigi 0b203b21df dockerfile: copy only files that are used
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-04-13 21:13:29 -07:00
Ian Campbell ddae5a6ea4 Make llb.ReadonlyRootFS usable with common container images
e.g. with busybox image:

    OCI runtime create failed: container_linux.go:348:
    starting container process caused "process_linux.go:402:
    container init caused \"rootfs_linux.go:58:
    mounting \\\"proc\\\" to rootfs \\\"/.../rootfs\\\" at \\\"/proc\\\"
    caused \\\"mkdir /.../rootfs/proc: read-only file system\\\"\"": unknown

This is because we were setting the underlying snapshot readonly so the various
mountpoints (here /proc) cannot be created. This would not be necessary if
those mountpoints were present in images but they typically are not.

The right way to get around this (used e.g. by `ctr`) is to use a writeable
snapshot but to set root readonly in the OCI spec. In this configuration the
rootfs is writeable when mounts are processed but is then made readonly by the
runtime (runc) just before entering the user specified binary within the
container.

This involved a surprising amount of plumbing.

Use this new found ability in the dockerfile converter's `dispatchCopy`
function.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-04-03 11:04:07 +01:00
Tonis Tiigi cd110f6b10 dockerfile: fix copy from implicit stage
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-02-21 18:17:30 -08:00
Tonis Tiigi ad6ab8aba2 dockerfile: new tests for copy
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-02-05 14:33:48 -05:00
Akihiro Suda 994c1a63af
Merge pull request #275 from vdemeester/add-linter-deadcode
Add deadcode to the linter
2018-02-02 11:13:29 +09:00
Vincent Demeester 79e346f59a
Add deadcode to the linter
it tends to help keeping uneeded code out O:)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-01 17:59:04 -08:00
Vincent Demeester 2f162c1138
Remove shell parser for dockerfile2llb, using moby upstream package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-01 17:46:51 -08:00
Vincent Demeester 08373f2381
Clean some small dependencies on docker/docker package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-02-01 16:05:24 -08:00
Tonis Tiigi 6cb4256e81 dockerfile: fix copy with wildcards and add tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-26 15:41:09 -08:00
Tonis Tiigi 7f513a4fd4 dockerfile: add copy —-chown support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-19 20:54:26 -08:00
Tonis Tiigi 2d3f36d359 source: add sharedkeyhint to local source
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-15 15:13:15 -08:00
Tonis Tiigi 08e1c2990c dockerfile: add dockerignore support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-15 15:03:35 -08:00
Akihiro Suda 571e14e003
Merge pull request #203 from tonistiigi/user
Add support for setting user
2017-12-13 13:06:07 +09:00
Tonis Tiigi e4f98e252d dockerfile: avoid pulling config for unreachable stages
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-12 15:02:19 -08:00
Tonis Tiigi 6626255a71 dockerfile: add support for user
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-12 10:28:37 -08:00
Tonis Tiigi 72afc856c8 dockerfile: add support for EXPOSE args
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-11 16:35:31 -08:00
Tonis Tiigi 1f93a77f78 dockerfile: fill history array
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-08 20:00:36 -08:00
Tonis Tiigi 438c850a16 dockerfile: add original command metadata to llb
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-07 16:13:50 -08:00
Tonis Tiigi b3568e7dcb dockerfile: return valid empty image config for scratch
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-04 23:16:23 -08:00
Tonis Tiigi 1b9c907ee4 dockerfile: add archive ADD support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-04 22:48:02 -08:00
Tonis Tiigi e0af9d1218 source: add more properties to http source
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-04 12:00:46 -08:00
Tonis Tiigi fc2f1687f9 dockerfile: add adding from URL support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-02 21:45:41 -08:00
Tonis Tiigi 2729373a03 reduce dependencies of llb package
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-11-30 17:29:57 -08:00
Tonis Tiigi b158114a6f dockerfile: fix copy to non-existing working dir
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-11-06 16:28:30 -08:00
Tonis Tiigi a6b1e4e399 dockerfile: allow building dockerfiles from git
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-11-06 16:27:20 -08:00
Tonis Tiigi 2809d01cf6 frontend: add gateway frontend / image frontend support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-10-03 21:14:03 -07:00
Tonis Tiigi 05c39612d8 dockerfile: resolve to digest ref in frontend
Less hacky than keeping the cached resolver.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-22 15:49:37 -07:00
Tonis Tiigi 0995c119bf dockerfile: implement onbuild support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-22 13:12:57 -07:00
Tonis Tiigi d258bcab7b dockerfile: clean up converter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-22 10:49:19 -07:00
Tonis Tiigi fd0f7ee2a8 frontend: fix dockerfile frontend resolver
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-15 18:09:28 -07:00
Tonis Tiigi 5a38d573fa frontend: add support for build args for dockerfile
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-15 18:09:28 -07:00
Tonis Tiigi 4c22f6c25a frontend: share attributes to exporter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-15 18:09:28 -07:00
Tonis Tiigi b36df4738a frontend: add more commands to dockerfile
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-15 18:09:28 -07:00
Tonis Tiigi 6d335c3c86 imagesource: share config resolver with frontend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-05 13:11:27 -07:00
Tonis Tiigi 4040029810 dockerfile: improve copy implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-09-01 19:27:54 -07:00
Tonis Tiigi 2d290db465 frontend: base of dockerfile frontend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-08-31 23:27:25 -07:00