gateway: allow frontends without network
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-19.03
parent
c5fe22fffe
commit
03a2f79561
|
@ -24,6 +24,7 @@ RUN --mount=target=. --mount=type=cache,target=/root/.cache \
|
|||
file /dockerfile-frontend | grep "statically linked"
|
||||
|
||||
FROM scratch AS release
|
||||
LABEL moby.buildkit.frontend.network.none="true"
|
||||
COPY --from=build /dockerfile-frontend /bin/dockerfile-frontend
|
||||
ENTRYPOINT ["/bin/dockerfile-frontend"]
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -193,12 +194,20 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten
|
|||
|
||||
env = append(env, "BUILDKIT_EXPORTEDPRODUCT="+apicaps.ExportedProduct)
|
||||
|
||||
err = llbBridge.Exec(ctx, executor.Meta{
|
||||
meta := executor.Meta{
|
||||
Env: env,
|
||||
Args: args,
|
||||
Cwd: cwd,
|
||||
ReadonlyRootFS: readonly,
|
||||
}, rootFS, lbf.Stdin, lbf.Stdout, os.Stderr)
|
||||
}
|
||||
|
||||
if v, ok := img.Config.Labels["moby.buildkit.frontend.network.none"]; ok {
|
||||
if ok, _ := strconv.ParseBool(v); ok {
|
||||
meta.NetMode = opspb.NetMode_NONE
|
||||
}
|
||||
}
|
||||
|
||||
err = llbBridge.Exec(ctx, meta, rootFS, lbf.Stdin, lbf.Stdout, os.Stderr)
|
||||
|
||||
if err != nil {
|
||||
// An existing error (set via Return rpc) takes
|
||||
|
|
Loading…
Reference in New Issue