Split run and logs
This commit is contained in:
parent
cce72978bf
commit
539cbd68a9
4 changed files with 56 additions and 13 deletions
10
app.go
10
app.go
|
|
@ -41,7 +41,15 @@ func NewApp() App {
|
|||
})
|
||||
|
||||
router.GET("/api/run", func(c *gin.Context) {
|
||||
stream, err := docker.RunHello()
|
||||
ctrid, err := docker.Run("hello-world")
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err})
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"jobid": ctrid})
|
||||
})
|
||||
|
||||
router.GET("/api/jobs/:jobid/logs", func(c *gin.Context) {
|
||||
stream, err := docker.Logs(c.Param("jobid"))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err})
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue