Skip to content
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

dockerfile: implement hooks for RUN instructions #4669

Closed
wants to merge 4 commits into from

Commits on Aug 24, 2024

  1. dockerfile: split Mount struct to dockerui/types

    Will be used in the follow-up commits for implementing "Dockerfile hooks"
    (issue 4576)
    
    Signed-off-by: Akihiro Suda <[email protected]>
    AkihiroSuda committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    7a5f59c View commit details
    Browse the repository at this point in the history
  2. dockerui/types.Mount: add JSON tags

    Signed-off-by: Akihiro Suda <[email protected]>
    AkihiroSuda committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    8cf4ecf View commit details
    Browse the repository at this point in the history
  3. dockerfile: split validateMount

    Signed-off-by: Akihiro Suda <[email protected]>
    AkihiroSuda committed Aug 24, 2024
    Configuration menu
    Copy the full SHA
    ca35037 View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2024

  1. dockerfile: implement hooks for RUN instructions

    Close issue 4576
    
    - - -
    
    e.g.,
    ```bash
    buildctl build \
      --frontend dockerfile.v0 \
      --opt hook="$(cat hook.json)"
    ```
    with `hook.json` as follows:
    ```json
    {
      "RUN": {
        "entrypoint": ["/dev/.dfhook/entrypoint"],
        "mounts": [
          {"from": "example.com/hook", "target": "/dev/.dfhook"},
          {"type": "secret", "source": "something", "target": "/etc/something"}
        ]
      }
    }
    ```
    
    This will let the frontend treat `RUN foo` as:
    ```dockerfile
    RUN \
      --mount=from=example.com/hook,target=/dev/.dfhook \
      --mount=type=secret,source=something,target=/etc/something \
      /dev/.dfhook/entrypoint foo
    ```
    
    `docker history` will still show this as `RUN foo`.
    
    Signed-off-by: Akihiro Suda <[email protected]>
    AkihiroSuda committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    ff80a37 View commit details
    Browse the repository at this point in the history