Skip to content

Commit

Permalink
chore: embed static content in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Nov 25, 2019
1 parent 966be54 commit 0410e99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 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 cd ./internal/dvserver && packr2
RUN make install

# minimalist runtime
Expand Down
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 0410e99

Please sign in to comment.