| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
package main |
| 34 |
|
| 35 |
import ( |
| 36 |
"fmt" |
| 37 |
"os" |
| 38 |
|
| 39 |
"github.com/awslabs/soci-snapshotter/cmd/soci/commands" |
| 40 |
"github.com/awslabs/soci-snapshotter/cmd/soci/commands/image" |
| 41 |
"github.com/awslabs/soci-snapshotter/cmd/soci/commands/index" |
| 42 |
"github.com/awslabs/soci-snapshotter/cmd/soci/commands/ztoc" |
| 43 |
"github.com/awslabs/soci-snapshotter/config" |
| 44 |
"github.com/awslabs/soci-snapshotter/version" |
| 45 |
"github.com/containerd/containerd/cmd/ctr/commands/run" |
| 46 |
"github.com/containerd/containerd/defaults" |
| 47 |
"github.com/containerd/containerd/namespaces" |
| 48 |
|
| 49 |
|
| 50 |
"github.com/containerd/containerd/pkg/seed" |
| 51 |
"github.com/urfave/cli" |
| 52 |
) |
| 53 |
|
| 54 |
func init() { |
| 55 |
|
| 56 |
seed.WithTimeAndRand() |
| 57 |
} |
| 58 |
|
| 59 |
func main() { |
| 60 |
app := cli.NewApp() |
| 61 |
app.Name = "soci" |
| 62 |
app.Flags = []cli.Flag{ |
| 63 |
cli.StringFlag{ |
| 64 |
Name: "address, a", |
| 65 |
Usage: "address for containerd's GRPC server", |
| 66 |
Value: defaults.DefaultAddress, |
| 67 |
EnvVar: "CONTAINERD_ADDRESS", |
| 68 |
}, |
| 69 |
cli.StringFlag{ |
| 70 |
Name: "namespace, n", |
| 71 |
Usage: "namespace to use with commands", |
| 72 |
Value: namespaces.Default, |
| 73 |
EnvVar: namespaces.NamespaceEnvVar, |
| 74 |
}, |
| 75 |
cli.DurationFlag{ |
| 76 |
Name: "timeout", |
| 77 |
Usage: "timeout for commands", |
| 78 |
}, |
| 79 |
cli.BoolFlag{ |
| 80 |
Name: "debug", |
| 81 |
Usage: "enable debug output", |
| 82 |
}, |
| 83 |
cli.StringFlag{ |
| 84 |
Name: "content-store", |
| 85 |
Usage: "use a specific content store (soci or containerd)", |
| 86 |
Value: config.DefaultContentStoreType, |
| 87 |
}, |
| 88 |
} |
| 89 |
|
| 90 |
app.Version = fmt.Sprintf("%s %s", version.Version, version.Revision) |
| 91 |
|
| 92 |
app.Commands = []cli.Command{ |
| 93 |
image.Command, |
| 94 |
index.Command, |
| 95 |
ztoc.Command, |
| 96 |
commands.CreateCommand, |
| 97 |
commands.PushCommand, |
| 98 |
run.Command, |
| 99 |
commands.RebuildDBCommand, |
| 100 |
} |
| 101 |
|
| 102 |
if err := app.Run(os.Args); err != nil { |
| 103 |
fmt.Fprintf(os.Stderr, "soci: %v\n", err) |
| 104 |
os.Exit(1) |
| 105 |
} |
| 106 |
} |