diff --git a/Dockerfile b/Dockerfile index 2ce5660..f11e05e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,16 @@ WORKDIR ui RUN npm install && ng build --prod -FROM golang:1.17.5 AS GO_BUILD +FROM golang:alpine AS GO_BUILD COPY ./ /server WORKDIR /server +ADD go.mod . +ADd go.sum . +RUN go mod download RUN go build -o /go/bin/server FROM alpine:3.15 WORKDIR app COPY --from=ANGULAR_BUILD /ui/dist/ui/* ./ui/dist/ui/ COPY --from=GO_BUILD /go/bin/server ./ -CMD /app/server +CMD ./server diff --git a/main.go b/main.go index bfd73c0..a1fb47a 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "path" "path/filepath" @@ -15,6 +16,7 @@ var ( func main() { //setAuth0Variables() + fmt.Println("Hallo") r := gin.Default() r.Use(CORSMiddleware()) r.NoRoute((func(c *gin.Context) { @@ -26,6 +28,7 @@ func main() { c.File("./ui/dist/ui/" + path.Join(dir, file)) } })) + //authorized := r.Group("/") //authorized.Use(authRequired()) @@ -40,6 +43,7 @@ func main() { } } + func CORSMiddleware() gin.HandlerFunc { return func(c *gin.Context) { c.Writer.Header().Set("Access-Control-Allow-Origin", "*") @@ -75,9 +79,10 @@ func authRequired() gin.HandlerFunc { c.Next() } } -*/ +*/ func terminateWithError(statusCode int, message string, c *gin.Context) { c.JSON(statusCode, gin.H{"error": message}) c.Abort() } +