User local accelerator if available

This commit is contained in:
Praneeth Bodduluri 2014-07-10 21:54:29 +02:00 committed by Pablo Carranza Vélez
parent 2f861fc4d8
commit be5a32187a
3 changed files with 29 additions and 2 deletions

View File

@ -14,11 +14,36 @@ BUILDSTEP_REPO = resin/rpi-buildstep-armv6hf
all: supervisor
BUILDSTEP_PRESENT = $(shell docker images | grep $(BUILDSTEP_VERSION) | awk '{print $$1}' | grep -xF $(BUILDSTEP_REPO) )
supervisor:
ifneq ($(BUILDSTEP_PRESENT) , )
echo "Using existing Build step from $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)"
else
docker pull $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)
docker tag $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) resin/supervisor-base:latest
endif
docker build --no-cache=$(DISABLE_CACHE) -t $(IMAGE):$(SUPERVISOR_VERSION) .
docker tag $(IMAGE):$(SUPERVISOR_VERSION) $(SUPERVISOR_REGISTRY)/$(IMAGE):$(SUPERVISOR_VERSION)
.PHONY: supervisor
ACCELERATOR = $(shell docker ps --all | grep buildstep-accelerator-latest | awk '{print $$1}' )
ifneq ($(ACCELERATOR) , )
supervisor-accelerated:
ifneq ($(BUILDSTEP_PRESENT) , )
echo "Using existing Build step from $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)"
else
docker pull $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)
docker tag $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) resin/supervisor-base:latest
endif
docker run --name build-supervisor-latest --volumes-from $(ACCELERATOR):ro -v `pwd`:/tmp/app $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) bash -i -c ". /.env && cp -r /tmp/app /app && /build/builder"
docker commit build-supervisor-latest $(IMAGE) > /dev/null
docker rm build-supervisor-latest
else
supervisor-accelerated:
echo 'Please run make accelerator in resin-buildstep to continue'
endif
.PHONY: supervisor supervisor-accelerated

View File

@ -3,7 +3,7 @@
"version": "0.0.1",
"scripts": {
"preinstall": "bash deps.sh",
"postinstall": "node ./node_modules/coffee-script/bin/coffee -c ./src && rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key ",
"postinstall": "bash postinstall.sh",
"start": "./entry.sh"
},
"dependencies": {

2
postinstall.sh Executable file
View File

@ -0,0 +1,2 @@
node ./node_modules/coffee-script/bin/coffee -c ./src
rm -rf /root/.ssh/* /build/app/deploy_key /app/deploy_key /build/app/Makefile /app/Makefile