github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/profiles/seccomp/generate.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"encoding/json"
     7  	"io/ioutil"
     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 := ioutil.WriteFile(f, b, 0644); err != nil {
    30  		panic(err)
    31  	}
    32  }