You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-07-01 00:55:01 +02:00
Switch from golang docker client to executing direct docker commands
github.com/docker/docker/client adds an additional 30 deps to the project and encoutering random errors when running on gitlab. Can't add file cmd/web-app/static/assets/images/glacier-example-pic.jpg to tar Error response from daemon: invalid reference format
This commit is contained in:
@ -3,7 +3,9 @@ package deploy
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -120,3 +122,24 @@ func exists(path string) (bool, error) {
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
|
||||
// execCmds executes a set of commands.
|
||||
func execCmds(log *log.Logger, workDir string, cmds ...[]string) (error) {
|
||||
for _, cmdVals := range cmds {
|
||||
cmd := exec.Command(cmdVals[0], cmdVals[1:]...)
|
||||
cmd.Dir = workDir
|
||||
cmd.Env = os.Environ()
|
||||
|
||||
cmd.Stderr = log.Writer()
|
||||
cmd.Stdout = log.Writer()
|
||||
|
||||
err := cmd.Run()
|
||||
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "failed to execute %s", strings.Join(cmdVals, " "))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user