diff --git a/Makefile b/Makefile index b447cc50b..17a0e4cf7 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ docker/weave: curl -L git.io/weave -o docker/weave chmod u+x docker/weave -$(SCOPE_EXPORT): $(APP_EXE) $(PROBE_EXE) $(DOCKER_DISTRIB) docker/weave $(RUNSVINIT) docker/Dockerfile docker/run-app docker/run-probe docker/entrypoint.sh docker/ca-certificates.crt +$(SCOPE_EXPORT): backend $(DOCKER_DISTRIB) docker/weave $(RUNSVINIT) docker/Dockerfile docker/run-app docker/run-probe docker/entrypoint.sh docker/ca-certificates.crt @if [ -z '$(DOCKER_SQUASH)' ] ; then echo "Please install docker-squash by running 'make deps' (and make sure GOPATH/bin is in your PATH)." && exit 1 ; fi cp $(APP_EXE) $(PROBE_EXE) docker/ cp $(DOCKER_DISTRIB) docker/docker.tgz @@ -91,13 +91,13 @@ $(SCOPE_BACKEND_BUILD_UPTODATE): backend/* 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 + docker run -ti $(RM) -v $(GOPATH)/src:/go/src -e GOARCH -e GOOS $(SCOPE_BACKEND_BUILD_IMAGE) /build.bash frontend: $(SCOPE_UI_BUILD_UPTODATE) clean: go clean ./... - rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_EXPORT) $(APP_EXE) $(PROBE_EXE) client/build/app.js docker/weave + rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_UPTODATE) $(SCOPE_BACKEND_BUILD_UPTODATE) $(APP_EXE) $(PROBE_EXE) client/build/app.js docker/weave deps: go get -u -f -tags netgo \ diff --git a/README.md b/README.md index f470baeb7..48824c14f 100644 --- a/README.md +++ b/README.md @@ -142,15 +142,13 @@ sudo scope launch --service-token= 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. `make backend` builds the backend Go app which then includes -the static files. The final `make` pushes the app into a Docker image called -**weaveworks/scope**. +for convenience. The final `make` builds the app and probe, in a container, +and pushes the lot into a Docker image called **weaveworks/scope**. ``` make deps make frontend make static -make backend make ``` diff --git a/backend/build.bash b/backend/build.bash index 134cf557b..e329d22f4 100755 --- a/backend/build.bash +++ b/backend/build.bash @@ -1,12 +1,11 @@ #!/bin/bash -set -x +set -eux # Mount the scope repo: # -v $(pwd):/go/src/github.com/weaveworks/scope -cd /go/src/github.com/weaveworks/scope -make deps +cd $GOPATH/src/github.com/weaveworks/scope make app/scope-app make probe/scope-probe diff --git a/circle.yml b/circle.yml index 61f182437..63fc47c9c 100644 --- a/circle.yml +++ b/circle.yml @@ -7,7 +7,7 @@ machine: services: - docker environment: - GOPATH: /home/ubuntu:$GOPATH + GOPATH: /home/ubuntu TOOLS: /home/ubuntu/src/github.com/weaveworks/tools SRCDIR: /home/ubuntu/src/github.com/weaveworks/scope PATH: $PATH:$HOME/.local/bin @@ -36,13 +36,17 @@ dependencies: - mkdir -p $(dirname $SRCDIR) - cp -r $(pwd)/ $SRCDIR - cd $SRCDIR/client; $TOOLS/rebuild-image weaveworks/scope-ui-build . Dockerfile package.json webpack.production.config.js .eslintrc + - cd $SRCDIR/backend; $TOOLS/rebuild-image weaveworks/scope-backend-build . Dockerfile build.sh + - touch $SRCDIR/.scope_backend_build.uptodate test: override: - cd $SRCDIR; $TOOLS/lint . - cd $SRCDIR; make RM= client-test - cd $SRCDIR; make RM= static - - cd $SRCDIR; rm -f app/scope-app probe/scope-probe; make + - cd $SRCDIR; rm -f app/scope-app probe/scope-probe; GOARCH=arm make RM= backend + - cd $SRCDIR; rm -f app/scope-app probe/scope-probe; GOOS=darwin make RM= backend + - cd $SRCDIR; rm -f app/scope-app probe/scope-probe; make RM= - cd $SRCDIR; $TOOLS/test -slow - cd $SRCDIR/experimental; make - test -z "$SECRET_PASSWORD" || (cd $SRCDIR/integration; ./gce.sh setup)