mirror of
https://github.com/containers/skopeo.git
synced 2026-05-17 04:23:37 +00:00
Flesh out v1 image configuration a bit
Basically finish building v1 images. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/mattn/go-shellwords"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -27,35 +28,35 @@ var (
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "user",
|
||||
Usage: "user name to run containers as",
|
||||
Usage: "user to run containers based on image as",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "port",
|
||||
Usage: "ports to expose when running containers",
|
||||
Usage: "port to expose when running containers based on image",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "env",
|
||||
Usage: "environment variable to set when running containers",
|
||||
Usage: "environment variable to set when running containers based on image",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
cli.StringFlag{
|
||||
Name: "entrypoint",
|
||||
Usage: "container entry point",
|
||||
Usage: "entry point for containers based on image",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
cli.StringFlag{
|
||||
Name: "cmd",
|
||||
Usage: "container command",
|
||||
Usage: "command for containers based on image",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "volume",
|
||||
Usage: "container volume",
|
||||
Usage: "volume to create for containers based on image",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "workingdir",
|
||||
Usage: "container working directory",
|
||||
Usage: "initial working directory for containers based on image",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "label",
|
||||
Usage: "container label",
|
||||
Usage: "image label e.g. label=value",
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -80,6 +81,8 @@ func updateConfig(c *cli.Context, config []byte) []byte {
|
||||
if image.OS == "" {
|
||||
image.OS = runtime.GOOS
|
||||
}
|
||||
image.History = []v1.History{}
|
||||
image.RootFS = v1.RootFS{}
|
||||
if c.IsSet("author") {
|
||||
image.Author = c.String("author")
|
||||
}
|
||||
@@ -89,11 +92,46 @@ func updateConfig(c *cli.Context, config []byte) []byte {
|
||||
if c.IsSet("os") {
|
||||
image.OS = c.String("os")
|
||||
}
|
||||
if c.IsSet("user") {
|
||||
image.Config.User = c.String("user")
|
||||
}
|
||||
if c.IsSet("port") {
|
||||
if image.Config.ExposedPorts == nil {
|
||||
image.Config.ExposedPorts = make(map[string]struct{})
|
||||
}
|
||||
for _, portSpec := range c.StringSlice("port") {
|
||||
image.Config.ExposedPorts[portSpec] = struct{}{}
|
||||
}
|
||||
}
|
||||
if c.IsSet("env") {
|
||||
for _, envSpec := range c.StringSlice("env") {
|
||||
image.Config.Env = append(append([]string{}, image.Config.Env...), envSpec)
|
||||
}
|
||||
}
|
||||
if c.IsSet("entrypoint") {
|
||||
entrypointSpec, err := shellwords.Parse(c.String("entrypoint"))
|
||||
if err != nil {
|
||||
logrus.Errorf("error parsing --entrypoint %q: %v", c.String("entrypoint"), err)
|
||||
} else {
|
||||
image.Config.Entrypoint = entrypointSpec
|
||||
}
|
||||
}
|
||||
if c.IsSet("cmd") {
|
||||
cmdSpec, err := shellwords.Parse(c.String("cmd"))
|
||||
if err != nil {
|
||||
logrus.Errorf("error parsing --cmd %q: %v", c.String("cmd"), err)
|
||||
} else {
|
||||
image.Config.Cmd = cmdSpec
|
||||
}
|
||||
}
|
||||
if c.IsSet("volume") {
|
||||
if image.Config.Volumes == nil {
|
||||
image.Config.Volumes = make(map[string]struct{})
|
||||
}
|
||||
for _, volSpec := range c.StringSlice("volume") {
|
||||
image.Config.Volumes[volSpec] = struct{}{}
|
||||
}
|
||||
}
|
||||
if c.IsSet("label") {
|
||||
for _, labelSpec := range c.StringSlice("label") {
|
||||
label := strings.SplitN(labelSpec, "=", 2)
|
||||
|
||||
31
vendor.conf
Normal file
31
vendor.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
github.com/containers/image master
|
||||
github.com/containers/storage master
|
||||
github.com/docker/distribution master
|
||||
github.com/docker/engine-api master
|
||||
github.com/docker/go-connections master
|
||||
github.com/docker/go-units master
|
||||
github.com/docker/libtrust master
|
||||
github.com/ghodss/yaml master
|
||||
github.com/gorilla/mux master
|
||||
github.com/imdario/mergo master
|
||||
github.com/mattn/go-runewidth master
|
||||
github.com/mattn/go-shellwords master
|
||||
github.com/mistifyio/go-zfs master
|
||||
github.com/mtrmac/gpgme master
|
||||
github.com/opencontainers/go-digest master
|
||||
github.com/opencontainers/image-spec master
|
||||
github.com/opencontainers/runc master
|
||||
github.com/opencontainers/runtime-spec master
|
||||
github.com/pborman/uuid master
|
||||
github.com/pkg/errors master
|
||||
github.com/Sirupsen/logrus master
|
||||
github.com/syndtr/gocapability master
|
||||
github.com/urfave/cli master
|
||||
github.com/vbatts/tar-split master
|
||||
golang.org/x/crypto/openpgp master
|
||||
golang.org/x/net master
|
||||
golang.org/x/sys master
|
||||
gopkg.in/cheggaaa/pb.v1 master
|
||||
gopkg.in/yaml.v2 master
|
||||
k8s.io/apimachinery master github.com/kubernetes/apimachinery
|
||||
k8s.io/kubernetes master github.com/kubernetes/kubernetes
|
||||
Reference in New Issue
Block a user