Merge pull request #474 from stevvooe/apply-command
dist: provide apply command to build rootfs
This commit is contained in:
commit
64a8f196ee
2 changed files with 31 additions and 0 deletions
30
cmd/dist/apply.go
vendored
Normal file
30
cmd/dist/apply.go
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
contextpkg "context"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/docker/containerd/log"
|
||||||
|
"github.com/docker/docker/pkg/archive"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
var applyCommand = cli.Command{
|
||||||
|
Name: "apply",
|
||||||
|
Usage: "apply layer from stdin to dir",
|
||||||
|
ArgsUsage: "[flags] <digest>",
|
||||||
|
Flags: []cli.Flag{},
|
||||||
|
Action: func(context *cli.Context) error {
|
||||||
|
var (
|
||||||
|
ctx = contextpkg.Background()
|
||||||
|
dir = context.Args().First()
|
||||||
|
)
|
||||||
|
|
||||||
|
log.G(ctx).Info("applying layer from stdin")
|
||||||
|
if _, err := archive.ApplyLayer(dir, os.Stdin); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
1
cmd/dist/main.go
vendored
1
cmd/dist/main.go
vendored
|
@ -35,6 +35,7 @@ distribution tool
|
||||||
pathCommand,
|
pathCommand,
|
||||||
deleteCommand,
|
deleteCommand,
|
||||||
listCommand,
|
listCommand,
|
||||||
|
applyCommand,
|
||||||
}
|
}
|
||||||
app.Before = func(context *cli.Context) error {
|
app.Before = func(context *cli.Context) error {
|
||||||
if context.GlobalBool("debug") {
|
if context.GlobalBool("debug") {
|
||||||
|
|
Loading…
Add table
Reference in a new issue