/* Copyright © 2022 Matthieu Derasse */ package cmd import ( "git.home.m-and-m.ovh/mderasse/gouick/helpers/api_types" "github.com/spf13/cobra" log "github.com/sirupsen/logrus" ) // dockerCmd represents the docker command. var dockerCmd = &cobra.Command{ Use: "docker", Short: "Generate Dockerfile & co for API, Crons and Workers", Run: runGenerateDocker, } func init() { generateCmd.AddCommand(dockerCmd) } // runGenerateDocker will generate the Dockerfile & co for the current project. func runGenerateDocker(cmd *cobra.Command, args []string) { log.Debugf("Starting command GenerateDocker") currentPath, config, err := loadProjectAndConfig() if err != nil { return } apiType, err := api_types.GetAPIType(config.ProjectType) if err != nil { log.Error("Impossible to load that API Type generator") return } // Generate Dockerfile log.Info("Generating Dockerfile") err = apiType.GenerateDockerfile(currentPath, config) if err != nil { log.Errorf("Fail to generate Dockerfile. The following error happen: %s", err.Error()) return } }