github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/reports/builder/2017-07-17.md (about) 1 # Development Report for July 17, 2017 2 3 4 ### BuildKit 5 6 [Repo](https://github.com/moby/buildkit) 7 [Proposal](https://github.com/moby/moby/issues/32925) 8 9 Following features were added last week: 10 11 #### Git source 12 13 Source code from git repositories can now be accessed directly, similarly for images can be accessed, without the need to execute `git clone`. This has many performance and caching advantages. It accesses the remote repository using shallow fetches to only pull the required data and a uses a shared bare repository for intermediate cache between build invocations. The instruction cache for the git source is based on a commit hash and not string arguments. This means that you can always be sure that you are building the correct source and that you never build the same source twice. 14 15 #### Containerd exporter 16 17 Exporters are used for getting build artifacts out of buildkit. The first exporter that was implemented allows exposing the image to containerd so it can be run and pushed with `ctr` tool. `buildctl` has `--exporter` flag for specifying the exporter and `--exporter-opt` for custom values passed to the exporter. In the case of image exporter an image name can be specified. 18 19 For example: 20 21 ``` 22 go run ./examples/buildkit2/buildkit.go | buildctl build --exporter image --exporter-opt name=docker.io/moby/buildkit:dev 23 ``` 24 25 Accessing from ctr/dist: 26 27 ``` 28 ctr --namespace buildkit images ls 29 ctr --namespace buildkit rootfs unpack <manifest-sha> 30 ctr --namespace buildkit run -t docker.io/moby/buildkit:dev id ash 31 ``` 32 33 #### Local source 34 35 Buildkit now supports building from local sources. Snapshot of the local source files is created similarly to `docker build` build context. The implementation is based on the [incremental context send](https://github.com/moby/moby/pull/32677) feature in `docker-v17.07`. To use in `buildctl` the source definition needs to define a name for local endpoint, and `buildctl build` command provides a mapping from this name to a local directory with a `--local` flag. 36 37 ``` 38 go run ./examples/buildkit3/buildkit.go --local | buildctl build --local buildkit-src=. 39 ``` 40 41 ### Typed Dockerfile parsing 42 43 [PR](https://github.com/moby/moby/pull/33492) 44 45 Didn't manage to merge this PR yet. Still in code-review. 46 47 48 ### Feedback for `RUN --mount` / `COPY --chown` 49 50 There was some new discussion around [`RUN --mount`](https://github.com/moby/moby/issues/32507) or [`COPY --chown`](https://github.com/moby/moby/issues/30110) feature. Currently, it seems that it may be best to try the shared cache capabilities described in `RUN --mount` in https://github.com/moby/buildkit first(it already supports the generic mounting capabilities). So to unblock the people waiting only on the file owner change features it may make sense to implement `COPY --chown` first. Another related candidate for `v17.08` release is https://github.com/moby/moby/issues/32816. 51 52 53 ### Proposals for new Dockerfile features that need design feedback: 54 55 [Add IMPORT/EXPORT commands to Dockerfile](https://github.com/moby/moby/issues/32100) 56 57 [Add `DOCKEROS/DOCKERARCH` default ARG to Dockerfile](https://github.com/moby/moby/issues/32487) 58 59 [Add support for `RUN --mount`](https://github.com/moby/moby/issues/32507) 60 61 [DAG image builder](https://github.com/moby/moby/issues/32550) 62 63 [Option to export the hash of the build context](https://github.com/moby/moby/issues/32963) (new) 64 65 [Allow --cache-from=*](https://github.com/moby/moby/issues/33002#issuecomment-299041162) (new) 66 67 [Provide advanced .dockeringore use-cases](https://github.com/moby/moby/issues/12886) [2](https://github.com/moby/moby/issues/12886#issuecomment-306247989) 68 69 New: [RFC: Distributed BuildKit](https://github.com/moby/buildkit/issues/62) 70 71 If you are interested in implementing any of them, leave a comment on the specific issues. 72 73 ### Builder features currently in code-review: 74 75 [Fix shallow git clone in docker-build](https://github.com/moby/moby/pull/33704) 76 77 ### Backlog 78 79 [Build secrets](https://github.com/moby/moby/issues/33343) has not got much traction. If you want this feature to become a reality, please make yourself heard.