2
0

docker.go 780 B

123456789101112131415161718192021222324252627282930313233343536
  1. package cmd
  2. import (
  3. "os"
  4. api "github.com/porter-dev/porter/api/client"
  5. ptypes "github.com/porter-dev/porter/api/types"
  6. "github.com/porter-dev/porter/cli/cmd/config"
  7. "github.com/spf13/cobra"
  8. )
  9. var dockerCmd = &cobra.Command{
  10. Use: "docker",
  11. Short: "Commands to configure Docker for a project",
  12. }
  13. var configureCmd = &cobra.Command{
  14. Use: "configure",
  15. Short: "Configures the host's Docker instance",
  16. Run: func(cmd *cobra.Command, args []string) {
  17. err := checkLoginAndRun(args, dockerConfig)
  18. if err != nil {
  19. os.Exit(1)
  20. }
  21. },
  22. }
  23. func init() {
  24. rootCmd.AddCommand(dockerCmd)
  25. dockerCmd.AddCommand(configureCmd)
  26. }
  27. func dockerConfig(user *ptypes.GetAuthenticatedUserResponse, client *api.Client, args []string) error {
  28. return config.SetDockerConfig(client)
  29. }