github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/pkg/compilers/osv/osv_native.go (about) 1 package osv 2 3 import ( 4 "fmt" 5 6 "github.com/solo-io/unik/pkg/compilers" 7 "github.com/solo-io/unik/pkg/types" 8 ) 9 10 type OSvNativeCompiler struct { 11 ImageFinisher ImageFinisher 12 } 13 14 func (r *OSvNativeCompiler) CompileRawImage(params types.CompileImageParams) (*types.RawImage, error) { 15 16 // Prepare meta/run.yaml for node runtime. 17 if err := addRuntimeStanzaToMetaRun(params.SourcesDir, "native"); err != nil { 18 return nil, err 19 } 20 21 // Create meta/package.yaml if not exist. 22 if err := assureMetaPackage(params.SourcesDir); err != nil { 23 return nil, err 24 } 25 26 // Parse image size from manifest.yaml. 27 params.SizeMB = int(readImageSizeFromManifest(params.SourcesDir)) 28 29 // Compose image inside Docker container. 30 imagePath, err := CreateImageDynamic(params, r.ImageFinisher.UseEc2()) 31 if err != nil { 32 return nil, err 33 } 34 35 // And finalize it. 36 convertParams := FinishParams{ 37 CompileParams: params, 38 CapstanImagePath: imagePath, 39 } 40 return r.ImageFinisher.FinishImage(convertParams) 41 } 42 43 func (r *OSvNativeCompiler) Usage() *compilers.CompilerUsage { 44 return &compilers.CompilerUsage{ 45 PrepareApplication: ` 46 (this is only needed if you want to run your own C/C++ application) 47 Compile your application into relocatable shared-object (a file normally 48 given a ".so" extension) that is PIC (position independent code). 49 `, 50 ConfigurationFiles: map[string]string{ 51 "/meta/run.yaml": ` 52 config_set: 53 conf1: 54 bootcmd: <boot-command-that-starts-application> 55 config_set_default: conf1 56 `, 57 "/meta/package.yaml": ` 58 title: <your-unikernel-title> 59 name: <your-unikernel-name> 60 author: <your-name> 61 require: 62 - <first-required-package-title> 63 - <second-required-package-title> 64 # ... 65 `, 66 "/manifest.yaml": ` 67 image_size: "10GB" # logical image size 68 `, 69 }, 70 Other: fmt.Sprintf(` 71 Below please find a list of packages in remote repository: 72 %s 73 `, listOfPackages()), 74 } 75 } 76 77 func listOfPackages() string { 78 return ` 79 eu.mikelangelo-project.app.hadoop-hdfs 80 eu.mikelangelo-project.app.mysql-5.6.21 81 eu.mikelangelo-project.erlang 82 eu.mikelangelo-project.ompi 83 eu.mikelangelo-project.openfoam.core 84 eu.mikelangelo-project.openfoam.pimplefoam 85 eu.mikelangelo-project.openfoam.pisofoam 86 eu.mikelangelo-project.openfoam.poroussimplefoam 87 eu.mikelangelo-project.openfoam.potentialfoam 88 eu.mikelangelo-project.openfoam.rhoporoussimplefoam 89 eu.mikelangelo-project.openfoam.rhosimplefoam 90 eu.mikelangelo-project.openfoam.simplefoam 91 eu.mikelangelo-project.osv.cli 92 eu.mikelangelo-project.osv.cloud-init 93 eu.mikelangelo-project.osv.httpserver 94 eu.mikelangelo-project.osv.nfs 95 ` 96 }