buildkit/frontend/dockerfile/dockerfile2llb/convert_runsecurity.go

25 lines
627 B
Go

// +build dfrunsecurity
package dockerfile2llb
import (
"github.com/pkg/errors"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"github.com/moby/buildkit/solver/pb"
)
func dispatchRunSecurity(c *instructions.RunCommand) (llb.RunOption, error) {
security := instructions.GetSecurity(c)
switch security {
case instructions.SecurityInsecure:
return llb.Security(pb.SecurityMode_INSECURE), nil
case instructions.SecuritySandbox:
return llb.Security(pb.SecurityMode_SANDBOX), nil
default:
return nil, errors.Errorf("unsupported security mode %q", security)
}
}