Merge pull request #479 from weaveworks/makefile

Makefile improvements.
This commit is contained in:
Tom Wilkie
2015-09-14 16:24:19 +08:00
3 changed files with 17 additions and 11 deletions

1
.gitignore vendored
View File

@@ -31,6 +31,7 @@ coverage.html
*~
# Project specific
.*.uptodate
scope.tar
scope_ui_build.tar
app/app

View File

@@ -9,13 +9,15 @@ PROBE_EXE=probe/scope-probe
FIXPROBE_EXE=experimental/fixprobe/fixprobe
SCOPE_IMAGE=$(DOCKERHUB_USER)/scope
SCOPE_EXPORT=scope.tar
SCOPE_UI_BUILD_EXPORT=scope_ui_build.tar
SCOPE_UI_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-ui-build
SCOPE_UI_BUILD_UPTODATE=.scope_ui_build.uptodate
SCOPE_BACKEND_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-backend-build
SCOPE_BACKEND_BUILD_UPTODATE=.scope_backend_build.uptodate
SCOPE_VERSION=$(shell git rev-parse --short HEAD)
DOCKER_VERSION=1.3.1
DOCKER_DISTRIB=docker/docker-$(DOCKER_VERSION).tgz
DOCKER_DISTRIB_URL=https://get.docker.com/builds/Linux/x86_64/docker-$(DOCKER_VERSION).tgz
RM=--rm
all: $(SCOPE_EXPORT)
@@ -54,32 +56,35 @@ static: client/build/app.js
client/build/app.js: client/app/scripts/*
mkdir -p client/build
docker run -ti -v $(shell pwd)/client/app:/home/weave/app \
docker run -ti $(RM) -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: client/test/*
docker run -ti -v $(shell pwd)/client/app:/home/weave/app \
docker run -ti $(RM) -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/test:/home/weave/test \
$(SCOPE_UI_BUILD_IMAGE) npm test
client-lint:
docker run -ti -v $(shell pwd)/client/app:/home/weave/app \
docker run -ti $(RM) -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:
docker run -ti --net=host -v $(shell pwd)/client/app:/home/weave/app \
docker run -ti $(RM) --net=host -v $(shell pwd)/client/app:/home/weave/app \
-v $(shell pwd)/client/build:/home/weave/build \
$(SCOPE_UI_BUILD_IMAGE) npm start
$(SCOPE_UI_BUILD_EXPORT): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/server.js client/.eslintrc
$(SCOPE_UI_BUILD_UPTODATE): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/server.js client/.eslintrc
docker build -t $(SCOPE_UI_BUILD_IMAGE) client
docker save $(SCOPE_UI_BUILD_IMAGE):latest > $@
touch $@
backend:
$(SCOPE_BACKEND_BUILD_UPTODATE): backend/*
docker build -t $(SCOPE_BACKEND_BUILD_IMAGE) backend
docker run -ti -v $(shell pwd):/go/src/github.com/weaveworks/scope $(SCOPE_BACKEND_BUILD_IMAGE) /build.bash
touch $@
backend: $(SCOPE_BACKEND_BUILD_UPTODATE)
docker run -ti $(RM) -v $(shell pwd):/go/src/github.com/weaveworks/scope $(SCOPE_BACKEND_BUILD_IMAGE) /build.bash
clean:
go clean ./...

View File

@@ -40,8 +40,8 @@ dependencies:
test:
override:
- cd $SRCDIR; $TOOLS/lint .
- cd $SRCDIR; make client-test
- cd $SRCDIR; make static
- cd $SRCDIR; make RM= client-test
- cd $SRCDIR; make RM= static
- cd $SRCDIR; rm -f app/scope-app probe/scope-probe; make
- cd $SRCDIR; $TOOLS/test -slow
- cd $SRCDIR/experimental; make