added docker container go SDK and build container implemented
This commit is contained in:
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"fmt"
|
||||
docker "git.sr.ht/~akilan1999/p2p-rendering-computation/server/docker"
|
||||
)
|
||||
|
||||
@@ -14,8 +15,21 @@ func Server() {
|
||||
c.JSON(http.StatusOK, ServerInfo())
|
||||
})
|
||||
|
||||
r.GET("/create_vm", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, docker.BuildContainer())
|
||||
r.GET("/create_vm/:virtualization", func(c *gin.Context) {
|
||||
virtualization := c.Param("virtualization")
|
||||
// Runs based on Preallocated VM size
|
||||
if virtualization == "docker" {
|
||||
sshinfo,err := docker.RunVM()
|
||||
if err != nil {
|
||||
c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err))
|
||||
}
|
||||
if sshinfo != nil {
|
||||
c.JSON(http.StatusOK, sshinfo)
|
||||
}
|
||||
|
||||
} else {
|
||||
c.String(200,"virtualization tool not selected")
|
||||
}
|
||||
})
|
||||
|
||||
// Port running on
|
||||
|
||||
Reference in New Issue
Block a user