github.com/rish1988/moby@v25.0.2+incompatible/profiles/seccomp/generate.go (about)

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