feat: mount container volumes based on kernel info
This commit is contained in:
@ -11,6 +11,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@ -117,6 +119,23 @@ func New(name string, timeout time.Duration) (c Container, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func NewFromKernelInfo(ki config.KernelInfo, timeout time.Duration) (
|
||||
c Container, err error) {
|
||||
|
||||
c.name = ki.ContainerName
|
||||
c.timeout = timeout
|
||||
|
||||
c.Log = log.With().
|
||||
Str("container", c.name).
|
||||
Logger()
|
||||
|
||||
c.Volumes.LibModules = path.Dir(ki.ModulesPath)
|
||||
c.Volumes.Boot = path.Dir(ki.KernelPath)
|
||||
c.Volumes.UsrSrc = filepath.Join(path.Dir(ki.KernelPath), "../usr/src")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (c Container) Build(imagePath string) (output string, err error) {
|
||||
args := []string{"build"}
|
||||
args = append(args, "-t", c.name, imagePath)
|
||||
|
Reference in New Issue
Block a user