image
This commit is contained in:
45
app/cmd/image/build.go
Normal file
45
app/cmd/image/build.go
Normal file
@ -0,0 +1,45 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"ledo/app/modules/context"
|
||||
"ledo/app/modules/docker"
|
||||
)
|
||||
|
||||
var CmdDockerBuild = cli.Command{
|
||||
Name: "build",
|
||||
Aliases: []string{"b"},
|
||||
Usage: "build docker image",
|
||||
Description: `Build docker image`,
|
||||
ArgsUsage: "version",
|
||||
Action: RunDockerBuild,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "stage",
|
||||
Aliases: []string{"s"},
|
||||
Value: "",
|
||||
Usage: "select stage to build (multi-stage dockerfile)",
|
||||
Required: false,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "dockerfile",
|
||||
Aliases: []string{"f"},
|
||||
Value: "./Dockerfile",
|
||||
Usage: "select dockerfile",
|
||||
Required: false,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "opts",
|
||||
Aliases: []string{"o"},
|
||||
Value: "--compress",
|
||||
Usage: "Additional build options",
|
||||
Required: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func RunDockerBuild(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
docker.ExecDockerBuild(ctx, cmd.Args(), *cmd)
|
||||
return nil
|
||||
}
|
22
app/cmd/image/fqn.go
Normal file
22
app/cmd/image/fqn.go
Normal file
@ -0,0 +1,22 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ledo/app/modules/docker"
|
||||
"ledo/app/modules/context"
|
||||
)
|
||||
|
||||
var CmdDockerFqn = cli.Command{
|
||||
Name: "fqn",
|
||||
Aliases: []string{"f"},
|
||||
Usage: "Docker image fqn",
|
||||
Description: `Get fqn docker image defined as main service in config file`,
|
||||
Action: RunDockerFqn,
|
||||
}
|
||||
|
||||
func RunDockerFqn(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
fmt.Printf("%v", docker.ShowDockerImageFQN(ctx))
|
||||
return nil
|
||||
}
|
22
app/cmd/image/push.go
Normal file
22
app/cmd/image/push.go
Normal file
@ -0,0 +1,22 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"ledo/app/modules/context"
|
||||
"ledo/app/modules/docker"
|
||||
)
|
||||
|
||||
var CmdDockerPush = cli.Command{
|
||||
Name: "push",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "push docker to registry",
|
||||
Description: `Push docker image to docker registry`,
|
||||
ArgsUsage: "version",
|
||||
Action: RunDockerPush,
|
||||
}
|
||||
|
||||
func RunDockerPush(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
docker.ExecDockerPush(ctx, cmd.Args())
|
||||
return nil
|
||||
}
|
22
app/cmd/image/retag.go
Normal file
22
app/cmd/image/retag.go
Normal file
@ -0,0 +1,22 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"ledo/app/modules/context"
|
||||
"ledo/app/modules/docker"
|
||||
)
|
||||
|
||||
var CmdDockerRetag = cli.Command{
|
||||
Name: "retag",
|
||||
Aliases: []string{"r"},
|
||||
Usage: "retag docker image",
|
||||
Description: `Change docker image tag`,
|
||||
ArgsUsage: "fromTag toTag",
|
||||
Action: RunDockerRetag,
|
||||
}
|
||||
|
||||
func RunDockerRetag(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
docker.ExecDockerRetag(ctx, cmd.Args())
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user