Skip to content

Commit

Permalink
Fixing static files problem in binary
Browse files Browse the repository at this point in the history
  • Loading branch information
relferreira committed Jan 11, 2019
1 parent 2ac8e4d commit a4c5382
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Go parameters
GOCMD=go
PACKRCMD=packr
GOBUILD=$(PACKRCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=kubedev
BINARY_MAC=$(BINARY_NAME)_darwin
BINARY_UNIX=$(BINARY_NAME)_unix

all: test build
build:
$(GOBUILD) -o $(BINARY_NAME) -v
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
# Cross compilation
build:
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_MAC) -v
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ yarn build
Package Server

```
gox
go get -u github.com/gobuffalo/packr/packr
make build
```
8 changes: 5 additions & 3 deletions glide.lock

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

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ import:
subpackages:
- wrapper/gin
- package: github.com/relferreira/sse
- package: github.com/gobuffalo/packr
version: ~2.0.0-rc.13
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"flag"
"io"
"log"
"net/http"
"os"
"path/filepath"
"time"

"github.com/gin-gonic/gin"
"github.com/gobuffalo/packr"
"github.com/relferreira/sse"
cors "github.com/rs/cors/wrapper/gin"
v1 "k8s.io/api/core/v1"
Expand All @@ -32,7 +32,9 @@ func main() {
clientset, err := kubernetes.NewForConfig(config)

r.Use(cors.Default())
r.StaticFS("/ui", http.Dir("./dist"))

box := packr.NewBox("./dist")
r.StaticFS("/ui", box)
r.GET("/api/:namespace/deploy", func(c *gin.Context) {
namespace := c.Param("namespace")

Expand Down

0 comments on commit a4c5382

Please sign in to comment.