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"
|
file /dockerfile-frontend | grep "statically linked"
|
||||||
|
|
||||||
FROM scratch AS release
|
FROM scratch AS release
|
||||||
|
LABEL moby.buildkit.frontend.network.none="true"
|
||||||
COPY --from=build /dockerfile-frontend /bin/dockerfile-frontend
|
COPY --from=build /dockerfile-frontend /bin/dockerfile-frontend
|
||||||
ENTRYPOINT ["/bin/dockerfile-frontend"]
|
ENTRYPOINT ["/bin/dockerfile-frontend"]
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -193,12 +194,20 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten
|
||||||
|
|
||||||
env = append(env, "BUILDKIT_EXPORTEDPRODUCT="+apicaps.ExportedProduct)
|
env = append(env, "BUILDKIT_EXPORTEDPRODUCT="+apicaps.ExportedProduct)
|
||||||
|
|
||||||
err = llbBridge.Exec(ctx, executor.Meta{
|
meta := executor.Meta{
|
||||||
Env: env,
|
Env: env,
|
||||||
Args: args,
|
Args: args,
|
||||||
Cwd: cwd,
|
Cwd: cwd,
|
||||||
ReadonlyRootFS: readonly,
|
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 {
|
if err != nil {
|
||||||
// An existing error (set via Return rpc) takes
|
// An existing error (set via Return rpc) takes
|
||||||
|
|
Loading…
Reference in New Issue