func (b *fromDockerImageBuilder) Build(img, refName string) error {
	tmpDir, err := ioutil.TempDir("", "filegrain-fromDockerImageBuilder")
	if err != nil {
		return err
	}
	defer os.RemoveAll(tmpDir)
	rootfs := filepath.Join(tmpDir, "rootfs")
	if err := os.Mkdir(rootfs, 0755); err != nil {
		return err
	}
	logrus.Infof("Unpacking docker image %s to %s", b.source, rootfs)
	if err = convertDockerImageToRootFS(rootfs, b.source); err != nil {
		return err
	}
	rb, err := NewBuilderWithRootFS(rootfs)
	if err != nil {
		return err
	}
	return rb.Build(img, refName)
}
// Build builds the FILEgrain image from b.source.
// Current implementation converts the source to raw rootfs,
// and internally uses fromRootFSBuilder.
// TODO: use fromOCIBuilder when `docker save` supports OCI.
Build builds the FILEgrain image from b.source.
Current implementation converts the source to raw rootfs,
and internally uses fromRootFSBuilder.
TODO: use fromOCIBuilder when `docker save` supports OCI.
// Build builds the FILEgrain image from b . source . // Current implementation converts the source to raw rootfs // and internally uses fromRootFSBuilder . // TODO : use fromOCIBuilder when ` docker save ` supports OCI .
func (b *fromDockerImageBuilder) Build(img, refName string) error {
	tmpDir, err := ioutil.TempDir("", "filegrain-fromDockerImageBuilder")
	if err != nil {
		return err
	}
	defer os.RemoveAll(tmpDir)
	rootfs := filepath.Join(tmpDir, "rootfs")
	if err := os.Mkdir(rootfs, 0755); err != nil {
		return err
	}
	logrus.Infof("Unpacking docker image %s to %s", b.source, rootfs)
	if err = convertDockerImageToRootFS(rootfs, b.source); err != nil {
		return err
	}
	rb, err := NewBuilderWithRootFS(rootfs)
	if err != nil {
		return err
	}
	return rb.Build(img, refName)
}
func ( b * fromDockerImageBuilder ) Build ( img , refName string ) error { tmpDir , err := ioutil . TempDir ( " " , " " ) if err != nil { return err } defer os . RemoveAll ( tmpDir ) rootfs := filepath . Join ( tmpDir , " " ) if err := os . Mkdir ( rootfs , 0755 ) ; err != nil { return err } logrus . Infof ( " " , b . source , rootfs ) if err = convertDockerImageToRootFS ( rootfs , b . source ) ; err != nil { return err } rb , err := NewBuilderWithRootFS ( rootfs ) if err != nil { return err } return rb . Build ( img , refName ) }
Build builds the FILEgrain image from b.source.
Build builds the FILEgrain image from b . source .