github.com/docker/engine@v22.0.0-20211208180946-d456264580cf+incompatible/profiles/seccomp/generate.go (about)

     1  //go:build ignore
     2  // +build ignore
     3  
     4  package main
     5  
     6  import (
     7  	"encoding/json"
     8  	"os"
     9  	"path/filepath"
    10  
    11  	"github.com/docker/docker/profiles/seccomp"
    12  )
    13  
    14  // saves the default seccomp profile as a json file so people can use it as a
    15  // base for their own custom profiles
    16  func main() {
    17  	wd, err := os.Getwd()
    18  	if err != nil {
    19  		panic(err)
    20  	}
    21  	f := filepath.Join(wd, "default.json")
    22  
    23  	// write the default profile to the file
    24  	b, err := json.MarshalIndent(seccomp.DefaultProfile(), "", "\t")
    25  	if err != nil {
    26  		panic(err)
    27  	}
    28  
    29  	if err := os.WriteFile(f, b, 0644); err != nil {
    30  		panic(err)
    31  	}
    32  }