From 9e5321eab8742d7b7722e1041e0fc99d2809a7b7 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 27 Jul 2020 22:33:44 -0700 Subject: [PATCH] build: support cacheonly exporter cacheonly is supported by moby so add support for buildx as well so same flags can be used Signed-off-by: Tonis Tiigi --- build/build.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/build.go b/build/build.go index 567f73d1..c83762c0 100644 --- a/build/build.go +++ b/build/build.go @@ -382,6 +382,15 @@ func toSolveOpt(d driver.Driver, multiDriver bool, opt Options, dl dockerLoadCal } } + // cacheonly is a fake exporter to opt out of default behaviors + exports := make([]client.ExportEntry, 0, len(opt.Exports)) + for _, e := range opt.Exports { + if e.Type != "cacheonly" { + exports = append(exports, e) + } + } + opt.Exports = exports + // set up exporters for i, e := range opt.Exports { if (e.Type == "local" || e.Type == "tar") && opt.ImageIDFile != "" {