diff options
author | Emiliano Ciavatta | 2020-07-08 11:20:28 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-07-08 11:20:28 +0000 |
commit | bcf5a985996c9988315bad5c3b745af4e48726c5 (patch) | |
tree | 60e03bab68f5890604e21a1c6cae480b2a2ce34e | |
parent | a264b5d90c25eadb03f1e064f60781755fcb1b82 (diff) |
Add docker-compose for production use
-rw-r--r-- | application_router.go | 5 | ||||
-rw-r--r-- | docker-compose.yml | 24 | ||||
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 2 |
4 files changed, 31 insertions, 1 deletions
diff --git a/application_router.go b/application_router.go index ea68e9d..bd876da 100644 --- a/application_router.go +++ b/application_router.go @@ -3,6 +3,7 @@ package main import ( "errors" "fmt" + "github.com/gin-gonic/contrib/static" "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" "net/http" @@ -17,7 +18,7 @@ func CreateApplicationRouter(applicationContext *ApplicationContext) *gin.Engine router.Use(gin.Recovery()) router.MaxMultipartMemory = 8 << 30 - // engine.Static("/", "./frontend/build") + router.Use(static.Serve("/", static.LocalFile("./frontend/build", true))) router.POST("/setup", func(c *gin.Context) { if applicationContext.IsConfigured { @@ -280,6 +281,8 @@ func CreateApplicationRouter(applicationContext *ApplicationContext) *gin.Engine }) } + + return router } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5d6813c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.7" +services: + + mongo: + image: mongo:4 + networks: + - acheronet + restart: always + + caronte: + build: + context: . + dockerfile: Dockerfile + image: caronte + ports: + - "80:3333" + depends_on: + - mongo + networks: + - acheronet + command: ./caronte -mongo-host mongo -mongo-port 27017 + +networks: + acheronet: @@ -4,6 +4,7 @@ go 1.14 require ( github.com/flier/gohs v1.0.0 + github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607 github.com/gin-gonic/gin v1.6.2 github.com/go-playground/validator/v10 v10.2.0 github.com/golang/protobuf v1.3.5 // indirect @@ -6,6 +6,8 @@ github.com/flier/gohs v1.0.0 h1:Q0mmufGWTigzKb140WmJ0+k3EGAf335Qgv/pz5SOPvU= github.com/flier/gohs v1.0.0/go.mod h1:Jlg6A1xXSMhPorF74/LkYHkCHZ87Txi8CqIHHyIKgKg= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607 h1:MrIm8EEPue08JS4eh+b08IOG+wd0WRWEHWnewNfWFX0= +github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg= github.com/gin-gonic/gin v1.6.2 h1:88crIK23zO6TqlQBt+f9FrPJNKm9ZEr7qjp9vl/d5TM= github.com/gin-gonic/gin v1.6.2/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= |