makefile should build app/static.go when needed

- Add non-containerised build for UI.
- Update README for new build steps.
This commit is contained in:
Paul Bellamy
2015-12-04 10:57:24 +00:00
committed by Tom Wilkie
parent 9878967263
commit 269a11759f
4 changed files with 18 additions and 18915 deletions

1
.gitignore vendored
View File

@@ -54,3 +54,4 @@ experimental/_integration/_integration
*sublime-project
*sublime-workspace
*npm-debug.log
app/static.go

View File

@@ -38,7 +38,7 @@ $(SCOPE_EXPORT): $(APP_EXE) $(PROBE_EXE) $(DOCKER_DISTRIB) docker/weave $(RUNSVI
$(RUNSVINIT): vendor/runsvinit/*.go
$(APP_EXE): app/*.go render/*.go report/*.go xfer/*.go common/sanitize/*.go
$(APP_EXE): app/*.go render/*.go report/*.go xfer/*.go common/sanitize/*.go app/static.go
$(PROBE_EXE): prog/probe/*.go $(shell find probe/ -type f -name *.go) report/*.go xfer/*.go common/sanitize/*.go common/exec/*.go
@@ -62,30 +62,35 @@ $(RUNSVINIT):
go build -ldflags "-extldflags \"-static\"" -o $@ ./$(@D)
endif
static: client/build/app.js
esc -o app/static.go -prefix client/build client/build
static: app/static.go
app/static.go: client/build/app.js
esc -o $@ -prefix client/build client/build
ifeq ($(BUILD_IN_CONTAINER),true)
client/build/app.js: $(shell find client/app/scripts -type f)
client/build/app.js: $(shell find client/app/scripts -type f) $(SCOPE_UI_BUILD_UPTODATE)
mkdir -p client/build
$(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/build:/home/weave/build \
$(SCOPE_UI_BUILD_IMAGE) npm run build
client-test: $(shell find client/app/scripts -type f)
client-test: $(shell find client/app/scripts -type f) $(SCOPE_UI_BUILD_UPTODATE)
$(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/test:/home/weave/test \
$(SCOPE_UI_BUILD_IMAGE) npm test
client-lint:
client-lint: $(SCOPE_UI_BUILD_UPTODATE)
$(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/test:/home/weave/test \
$(SCOPE_UI_BUILD_IMAGE) npm run lint
client-start:
client-start: $(SCOPE_UI_BUILD_UPTODATE)
$(SUDO) docker run $(RM) $(RUN_FLAGS) --net=host -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/build:/home/weave/build \
$(SCOPE_UI_BUILD_IMAGE) npm start
else
client/build/app.js:
cd client && npm run build
endif
$(SCOPE_UI_BUILD_UPTODATE): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/server.js client/.eslintrc
@@ -96,8 +101,6 @@ $(SCOPE_BACKEND_BUILD_UPTODATE): backend/*
$(SUDO) docker build -t $(SCOPE_BACKEND_BUILD_IMAGE) backend
touch $@
frontend: $(SCOPE_UI_BUILD_UPTODATE)
clean:
go clean ./...
$(SUDO) docker rmi $(SCOPE_UI_BUILD_IMAGE) $(SCOPE_BACKEND_BUILD_IMAGE) >/dev/null 2>&1 || true

View File

@@ -192,16 +192,14 @@ Kubernetes-specific views "Pods", and "Pods by Service".
## <a name="developing"></a>Developing
The build is in five stages. `make deps` installs some tools we use later in
the build. `make frontend` builds a UI build image with all NPM dependencies.
`make static` compiles the UI into `static.go` which is part of the repository
for convenience. The final `make` builds the app and probe, in a container,
and pushes the lot into a Docker image called **weaveworks/scope**.
The build is in two stages. `make deps` installs some tools we use later in
the build. `make` builds the UI build container, builds the UI in said
container, builds the backend build container, builds the app and probe in a
said container, and finally pushes the lot into a Docker image called
**weaveworks/scope**.
```
make deps
make frontend
make static
make
```

File diff suppressed because it is too large Load Diff