-
Notifications
You must be signed in to change notification settings - Fork 637
add support for oci-layout build-context #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,7 @@ More built-in build args can be found in [dockerfile frontend docs](https://gith | |
| Define additional build context with specified contents. In Dockerfile the context can be accessed when `FROM name` or `--from=name` is used. | ||
| When Dockerfile defines a stage with the same name it is overwritten. | ||
|
|
||
| The value can be a local source directory, container image (with docker-image:// prefix), Git or HTTP URL. | ||
| The value can be a local source directory, [local OCI layout compliant directory](https://github.com/opencontainers/image-spec/blob/main/image-layout.md), container image (with docker-image:// prefix), Git or HTTP URL. | ||
|
|
||
| Replace `alpine:latest` with a pinned one: | ||
|
|
||
|
|
@@ -126,6 +126,32 @@ FROM alpine | |
| COPY --from=project myfile / | ||
| ``` | ||
|
|
||
| #### <a name="source-oci-layout"></a> Source image from OCI layout directory | ||
|
|
||
| Source an image from a local [OCI layout compliant directory](https://github.com/opencontainers/image-spec/blob/main/image-layout.md): | ||
|
|
||
| ```console | ||
| $ docker buildx build --build-context foo=oci-layout:///path/to/local/layout@sha256:abcd12345 . | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should allow this input without the digest as well in here. If no digest is set it can look up
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am hesitant about this, as it wades into a deep unresolved issue around what actually should be in containerd does a bit of a hybrid: directory is a full registry, but tag->manifest-hash is in the boltdb. Let's get this working with the hash required, as is, and then let's deal with supporting hash-less - both in buildkit and in buildx - as a separate iteration. |
||
| ``` | ||
|
|
||
| ```Dockerfile | ||
| FROM alpine | ||
| RUN apk add git | ||
|
|
||
| COPY --from=foo myfile / | ||
|
|
||
| FROM foo | ||
| ``` | ||
|
|
||
| The OCI layout directory must be compliant with the [OCI layout specification](https://github.com/opencontainers/image-spec/blob/main/image-layout.md). It looks _solely_ for hashes. It does not | ||
| do any form of `image:tag` resolution to find the hash of the manifest; that is up to you. | ||
|
|
||
| The format of the `--build-context` must be: `<context>=oci-layout://<path-to-local-layout>@sha256:<hash-of-manifest>`, where: | ||
|
|
||
| * `context` is the name of the build context as used in the `Dockerfile`. | ||
| * `path-to-local-layout` is the path on the local machine, where you are running `docker build`, to the spec-compliant OCI layout. | ||
| * `hash-of-manifest` is the hash of the manifest for the image. It can be a single-architecture manifest or a multi-architecture index. | ||
|
|
||
| ### <a name="builder"></a> Override the configured builder instance (--builder) | ||
|
|
||
| Same as [`buildx --builder`](buildx.md#builder). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update line 109 with OCI layout directory and add an intented subtitle for OCI layout for the new content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Back to you @tonistiigi