Skip to content

Commit

Permalink
Merge pull request #22 from Doer-org/feature/port
Browse files Browse the repository at this point in the history
Feature/port
  • Loading branch information
clcl777 authored Feb 10, 2024
2 parents 2780df9 + 5de51ce commit 06f4634
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ var createCmd = &cobra.Command{
Short: "Create Docker image based on your local environment",
Long: `This command creates a docker image based on the local environment,
compresses it, and sends it to the server.`,
Args: cobra.ExactArgs(0),
PreRun: func(cmd *cobra.Command, args []string) {
fmt.Println(`
__ __ ________________ _____
Expand All @@ -30,7 +29,10 @@ var createCmd = &cobra.Command{
`)
},
RunE: func(cmd *cobra.Command, args []string) error {
path, err := cmd.Flags().GetString("path")
if len(args) > 0 {
return fmt.Errorf("unexpected argument(s): %v\nUsage: %s", args, cmd.UseLine())
}
directory, err := cmd.Flags().GetString("directory")
if err != nil {
return err
}
Expand All @@ -46,14 +48,22 @@ var createCmd = &cobra.Command{
if err != nil {
return err
}
fmt.Println("path: ", path)
publishList, err := cmd.Flags().GetStringSlice("publish")
if err != nil {
return err
}
envList, err := cmd.Flags().GetStringSlice("env")
if err != nil {
return err
}
fmt.Println("directory: ", directory)

err = docker.CreateImage(dockerfile, language, path, filename)
err = docker.CreateImage(dockerfile, language, directory, filename)
if err != nil {
return err
}
docker.CompressImageToTarGz()
err = api.SendTarToServer()
err = api.SendTarToServer(publishList, envList)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/api/send_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// TODO: 取り敢えず書いてみただけなので、動作確認しつつ適宜変更してください。
func SendTarToServer() error {
func SendTarToServer(publishList []string, envList []string) error {
file, err := os.Open(filePath)
if err != nil {
return err
Expand Down

0 comments on commit 06f4634

Please sign in to comment.