Skip to content

Commit 279c736

Browse files
authored
Merge pull request #211 from arangodb/feature/dashboard
Feature/dashboard
2 parents b890024 + c38bb71 commit 279c736

File tree

377 files changed

+125784
-13974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+125784
-13974
lines changed

Makefile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SRCDIR := $(SCRIPTDIR)
1313
CACHEVOL := $(PROJECT)-gocache
1414
BINDIR := $(ROOTDIR)/bin
1515
VENDORDIR := $(ROOTDIR)/deps
16+
DASHBOARDDIR := $(ROOTDIR)/dashboard
1617

1718
ORGPATH := github.com/arangodb
1819
ORGDIR := $(GOBUILDDIR)/src/$(ORGPATH)
@@ -24,6 +25,7 @@ GOPATH := $(GOBUILDDIR)
2425
GOVERSION := 1.10.0-alpine
2526

2627
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
28+
GOASSETSBUILDER := $(GOBUILDDIR)/bin/go-assets-builder$(shell go env GOEXE)
2729

2830
DOCKERFILE := Dockerfile
2931
DOCKERTESTFILE := Dockerfile.test
@@ -70,6 +72,7 @@ endif
7072
ifndef ENTERPRISEIMAGE
7173
ENTERPRISEIMAGE := $(DEFAULTENTERPRISEIMAGE)
7274
endif
75+
DASHBOARDBUILDIMAGE := kube-arangodb-dashboard-builder
7376

7477
ifndef ALLOWCHAOS
7578
ALLOWCHAOS := true
@@ -95,6 +98,7 @@ ifdef VERBOSE
9598
endif
9699

97100
SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
101+
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js' -not -path './test/*')
98102

99103
.PHONY: all
100104
all: verify-generated build
@@ -108,7 +112,7 @@ build: check-vars docker manifests
108112

109113
.PHONY: clean
110114
clean:
111-
rm -Rf $(BIN) $(BINDIR) $(GOBUILDDIR)
115+
rm -Rf $(BIN) $(BINDIR) $(GOBUILDDIR) $(DASHBOARDDIR)/build $(DASHBOARDDIR)/node_modules
112116

113117
.PHONY: check-vars
114118
check-vars:
@@ -123,10 +127,11 @@ deps:
123127
@${MAKE} -B -s $(GOBUILDDIR)
124128

125129
$(GOBUILDDIR):
126-
# Build pulsar from vendor
130+
# Build pulsar & go-assets-builder from vendor
127131
@mkdir -p $(GOBUILDDIR)
128132
@ln -sf $(VENDORDIR) $(GOBUILDDIR)/src
129133
@GOPATH=$(GOBUILDDIR) go install github.com/pulcy/pulsar
134+
@GOPATH=$(GOBUILDDIR) go install github.com/jessevdk/go-assets-builder
130135
@rm -Rf $(GOBUILDDIR)/src
131136
# Prepare .gobuild directory
132137
@mkdir -p $(ORGDIR)
@@ -187,7 +192,17 @@ update-generated: $(GOBUILDDIR)
187192
verify-generated:
188193
@${MAKE} -B -s VERIFYARGS=--verify-only update-generated
189194

190-
$(BIN): $(GOBUILDDIR) $(CACHEVOL) $(SOURCES)
195+
dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
196+
cd $(DASHBOARDDIR) && docker build -t $(DASHBOARDBUILDIMAGE) -f Dockerfile.build $(DASHBOARDDIR)
197+
@mkdir -p $(DASHBOARDDIR)/build
198+
docker run --rm \
199+
-v $(DASHBOARDDIR)/build:/usr/code/build \
200+
-v $(DASHBOARDDIR)/public:/usr/code/public:ro \
201+
-v $(DASHBOARDDIR)/src:/usr/code/src:ro \
202+
$(DASHBOARDBUILDIMAGE)
203+
$(GOASSETSBUILDER) -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
204+
205+
$(BIN): $(GOBUILDDIR) $(CACHEVOL) $(SOURCES) dashboard/assets.go
191206
@mkdir -p $(BINDIR)
192207
docker run \
193208
--rm \
@@ -202,6 +217,8 @@ $(BIN): $(GOBUILDDIR) $(CACHEVOL) $(SOURCES)
202217
golang:$(GOVERSION) \
203218
go build -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o /usr/code/bin/$(BINNAME) $(REPOPATH)
204219

220+
221+
205222
.PHONY: docker
206223
docker: check-vars $(BIN)
207224
docker build -f $(DOCKERFILE) -t $(OPERATORIMAGE) .

dashboard/.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/node_modules
2+
3+
# testing
4+
/coverage
5+
6+
# production
7+
/build
8+

dashboard/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

dashboard/Dockerfile.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:10.6-alpine
2+
3+
RUN mkdir -p /usr/code
4+
ADD package-lock.json /usr/code/
5+
ADD package.json /usr/code/
6+
7+
RUN cd /usr/code/ && npm install
8+
9+
VOLUME /usr/code/build
10+
VOLUME /usr/code/public
11+
VOLUME /usr/code/src
12+
13+
WORKDIR /usr/code/
14+
CMD ["npm", "run-script", "build"]

0 commit comments

Comments
 (0)