Skip to content

Commit

Permalink
capture errors better for buildProjectDockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
DireLines committed Aug 23, 2024
1 parent 4c49d93 commit dd03b8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
5 changes: 4 additions & 1 deletion cmd/project/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,10 @@ func buildProjectDockerfile() (err error) {
// save to Dockerfile in project directory
projectFolder, _ := os.Getwd()
dockerfilePath := filepath.Join(projectFolder, "Dockerfile")
os.WriteFile(dockerfilePath, []byte(dockerfile), 0o644)
err = os.WriteFile(dockerfilePath, []byte(dockerfile), 0o644)
if err != nil {
return err
}
fmt.Printf("Dockerfile created at %s\n", dockerfilePath)
return nil
}
24 changes: 5 additions & 19 deletions cmd/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,25 +357,11 @@ var BuildProjectDockerfileCmd = &cobra.Command{
Short: "builds Dockerfile for current project",
Long: "builds a local Dockerfile for the project in the current folder. You can use this Dockerfile to build an image and deploy it to any API server.",
Run: func(cmd *cobra.Command, args []string) {
buildProjectDockerfile()
// config := loadProjectConfig()
// projectConfig := config.Get("project").(*toml.Tree)
// projectId := projectConfig.Get("uuid").(string)
// projectName := config.Get("name").(string)
// //print next steps
// fmt.Println("Next steps:")
// fmt.Println()
// suggestedDockerTag := fmt.Sprintf("runpod-sls-worker-%s-%s:0.1", projectName, projectId)
// //docker build
// fmt.Println("# Build Docker image")
// fmt.Printf("docker build -t %s .\n", suggestedDockerTag)
// //dockerhub push
// fmt.Println("# Push Docker image to a container registry such as Dockerhub")
// fmt.Printf("docker push %s\n", suggestedDockerTag)
// //go to runpod url and deploy
// fmt.Println()
// fmt.Println("Deploy docker image as a serverless endpoint on Runpod")
// fmt.Println("https://www.runpod.io/console/serverless")
err := buildProjectDockerfile()
if err != nil {
log.Fatalf("Error generating endpoint configuration: %v", err)
return
}
},
}

Expand Down

0 comments on commit dd03b8c

Please sign in to comment.