Dockerfile corrected. Build failures

This commit is contained in:
2022-01-04 21:48:57 +01:00
parent 65e884e3cb
commit 58fac0aa1e
2 changed files with 11 additions and 3 deletions

View File

@@ -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

View File

@@ -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()
}