a open source hackthon project where this will create a docker image out of a repo, submit it to a VPS server, and return a url along with many other fun features to entice people to code more and show off their work.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
466 B

package docker
import (
"log"
"os"
"os/exec"
"strconv"
)
func MakeDockerImage(hackathonId int, imageName string, dir string) error {
image := imageName + ":" + strconv.Itoa(hackathonId) + ":latest"
dockerfileDir := "."
cmd := exec.Command("docker", "build", "-t", image, dockerfileDir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Printf("error creating docker image: %v\n", err)
return err
}
return nil
}