Skip to content

Commit

Permalink
Merge pull request #197 from moul/dev/moul/docker-static
Browse files Browse the repository at this point in the history
chore: embed static content in docker
  • Loading branch information
moul authored Nov 25, 2019
2 parents 966be54 + d6e428f commit c445cd7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ coverage.txt
.#*
depviz.db
/vendor/
packrd/
*-packr.go
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/dvserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c445cd7

Please sign in to comment.