Skip to content

Commit

Permalink
docs: add function to be included when using buildkit.SolveToDocker (#…
Browse files Browse the repository at this point in the history
…698)

Signed-off-by: Shishir Kushwaha <[email protected]>
  • Loading branch information
shishir-11 committed Jul 11, 2024
1 parent 9e4308b commit d563d3a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions website/docs/development-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ The folder specified defaults to the system temp folder unless the `--working-fo

It's often useful to be able to inspect what the output of an intermediate LLB stage would look like after it has executed, and you can perform an analog to `printf` debugging by solving the LLB stage to a Docker image and then inspecting the resulting image:

```go
// Add this to pkg/buildkit/buildkit.go to use
func SolveToDocker(ctx context.Context, c *client.Client, st *llb.State, configData []byte, tag string) error {
def, err := st.Marshal(ctx)
if err != nil {
log.Errorf("st.Marshal failed with %s", err)
return err
```
```go
// DEBUG: Solve the LLB stage to a Docker image.
if err := buildkit.SolveToDocker(ctx, dm.config.Client, &<llb.Stage>, dm.config.ConfigData, dm.config.ImageName+"-<llb.Stage suffix>"); err != nil {
Expand Down

0 comments on commit d563d3a

Please sign in to comment.