feat: add dockerfile

This commit is contained in:
Yanislav Igonin 2021-08-28 19:30:14 +03:00
parent a7f31e48c2
commit 299c44cd73
2 changed files with 10 additions and 4 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM busybox
WORKDIR /app
COPY templates/ templates/
COPY micrach ./
ENTRYPOINT ["/app/micrach"]

View File

@ -9,14 +9,14 @@ import (
Config "micrach/config" Config "micrach/config"
Controllers "micrach/controllers" Controllers "micrach/controllers"
Db "micrach/db" // Db "micrach/db"
// Utils "micrach/utils" // Utils "micrach/utils"
) )
func main() { func main() {
Config.Init() Config.Init()
Db.Init() // Db.Init()
defer Db.Pool.Close() // defer Db.Pool.Close()
gin.SetMode(Config.App.Env) gin.SetMode(Config.App.Env)
router := gin.Default() router := gin.Default()
@ -27,7 +27,8 @@ func main() {
router.GET("/:threadId", Controllers.GetThread) router.GET("/:threadId", Controllers.GetThread)
router.POST("/:threadId", Controllers.UpdateThread) router.POST("/:threadId", Controllers.UpdateThread)
log.Println("port", Config.App.Port, "- online")
log.Println("all systems nominal") log.Println("all systems nominal")
router.Run("localhost:" + strconv.Itoa(Config.App.Port)) router.Run(":" + strconv.Itoa(Config.App.Port))
} }