diff --git a/.gitignore b/.gitignore index 6c7a999f2..bf820a036 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ coverage.txt .#* depviz.db /vendor/ +packrd/ +*-packr.go diff --git a/Dockerfile b/Dockerfile index 08c12a584..c8fedb6cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,13 @@ ARG VERSION # build FROM golang:1.13-alpine as build RUN apk add --update --no-cache git gcc musl-dev make +RUN GO111MODULE=off go get github.com/gobuffalo/packr/v2/packr2 WORKDIR /go/src/moul.io/depviz ENV GO111MODULE=on COPY go.* ./ RUN go mod download COPY . ./ +RUN make packr RUN make install # minimalist runtime diff --git a/Makefile b/Makefile index 8c51b70ee..00e180af1 100644 --- a/Makefile +++ b/Makefile @@ -65,3 +65,9 @@ generate_local: .PHONY: clean clean: rm -f gen.sum $(wildcard */*/*.pb.go */*/*.pb.gw.go) $(wildcard out/*) + + +.PHONY: packr +packr: + GO111MODULE=off go get github.com/gobuffalo/packr/v2/packr2 + cd internal/dvserver && packr2 diff --git a/gen.sum b/gen.sum index 0041376e2..212b46d5b 100644 --- a/gen.sum +++ b/gen.sum @@ -1,3 +1,3 @@ 4668890e2f9fc8852ff7696d493dab0d644fc5f4 ./api/dvmodel.proto -8cc6dc3b17512179922b8df568c1ed230f0a47c5 Makefile +7f1dee3d1a55e569a08d2eab477f5d857fe6eaf0 Makefile d8a569f515deddba8c2bbdcac334afee3529eee5 ./api/dvserver.proto diff --git a/internal/dvserver/server.go b/internal/dvserver/server.go index ce7c8f8c4..e7e837b60 100644 --- a/internal/dvserver/server.go +++ b/internal/dvserver/server.go @@ -13,7 +13,7 @@ import ( "github.com/cayleygraph/cayley/schema" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" - "github.com/gobuffalo/packr/v2" + packr "github.com/gobuffalo/packr/v2" "github.com/gogo/gateway" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" @@ -196,7 +196,7 @@ func New(ctx context.Context, h *cayley.Handle, schema *schema.Config, opts Opts } // static content - box := packr.New("web", "./web") + box := packr.New("web", "../../web") chiutil.FileServer(r, "/", box) http.DefaultServeMux = http.NewServeMux() // disables default handlers registere by importing net/http/pprof for security reasons