Skip to content

Commit

Permalink
update backend start to use docker (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpeng02 authored May 20, 2024
1 parent 6dca7e3 commit 7eb0ec0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/backend/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Copyright © 2023 NAME HERE <EMAIL ADDRESS>
package start

import (
"fmt"

"github.com/DSGT-DLP/Deep-Learning-Playground/cli/cmd/backend"
"github.com/spf13/cobra"
)
Expand All @@ -14,15 +12,13 @@ import (
var StartCmd = &cobra.Command{
Use: "start",
Short: "Starts the training backend",
Long: `Starts an instance of the training backend Django app in /training in the terminal`,
Long: `Starts an instance of the training backend Django app in /training in the terminal. To change the backend port, set the environment var BACKEND_PORT. `,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
env_name := cmd.Flag("env-name").Value.String()
backend.ExecBashCmd("mamba", "run", "--live-stream", "-n", env_name, "poetry", "run", "python", "manage.py", "runserver", fmt.Sprintf("%v", cmd.Flag("port").Value))
backend.ExecBashCmd("docker", "compose", "up", "--build")
},
}

func init() {
backend.BackendCmd.AddCommand(StartCmd)
StartCmd.PersistentFlags().IntP("port", "p", 8000, "A port to run the backend on")
}

0 comments on commit 7eb0ec0

Please sign in to comment.