with docker
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-10-31 21:57:16 +01:00
parent 03fb65a9b4
commit f44ef84c89
8 changed files with 210 additions and 5 deletions

40
pkg/cli/build_docker.go Normal file
View File

@@ -0,0 +1,40 @@
package cli
import (
"errors"
"os"
"git.front.kjuulh.io/kjuulh/bust/pkg/builder"
"git.front.kjuulh.io/kjuulh/bust/pkg/pipelines"
"github.com/spf13/cobra"
)
func BuildDocker() *cobra.Command {
cmd := &cobra.Command{
Use: "docker",
RunE: func(cmd *cobra.Command, args []string) error {
repoName := os.Getenv("DRONE_REPO_NAME")
if repoName == "" {
return errors.New("could not find DRONE_REPO_NAME")
}
ctx := cmd.Context()
builder, err := builder.New(ctx)
if err != nil {
return err
}
defer builder.CleanUp()
return pipelines.
New(builder).
WithDocker(&pipelines.DockerOpt{
DockerImageOpt: &pipelines.DockerImageOpt{ImageName: repoName},
Path: "Dockerfile",
}).
Execute(ctx)
},
}
return cmd
}