2014-07-03 15:29:49 +00:00
|
|
|
DISABLE_CACHE = 'false'
|
|
|
|
|
|
|
|
IMAGE = resin/rpi-supervisor
|
|
|
|
|
|
|
|
SUPERVISOR_REGISTRY = registry.staging.resin.io
|
|
|
|
|
|
|
|
SUPERVISOR_VERSION = latest
|
|
|
|
|
|
|
|
BUILDSTEP_REGISTRY = registry.staging.resin.io
|
|
|
|
|
|
|
|
BUILDSTEP_VERSION = latest
|
|
|
|
|
2014-07-10 13:57:57 +00:00
|
|
|
BUILDSTEP_REPO = resin/rpi-buildstep-armv6hf
|
|
|
|
|
2014-07-03 15:29:49 +00:00
|
|
|
all: supervisor
|
|
|
|
|
2014-07-10 19:54:29 +00:00
|
|
|
BUILDSTEP_PRESENT = $(shell docker images | grep $(BUILDSTEP_VERSION) | awk '{print $$1}' | grep -xF $(BUILDSTEP_REPO) )
|
|
|
|
|
2014-07-03 15:29:49 +00:00
|
|
|
supervisor:
|
2014-07-10 19:54:29 +00:00
|
|
|
ifneq ($(BUILDSTEP_PRESENT) , )
|
|
|
|
echo "Using existing Build step from $(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)"
|
|
|
|
else
|
2014-07-10 13:57:57 +00:00
|
|
|
docker pull $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION)
|
2014-07-10 19:54:29 +00:00
|
|
|
endif
|
2014-07-18 13:57:46 +00:00
|
|
|
docker tag $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) resin/supervisor-base:latest
|
2014-07-03 15:29:49 +00:00
|
|
|
docker build --no-cache=$(DISABLE_CACHE) -t $(IMAGE):$(SUPERVISOR_VERSION) .
|
|
|
|
docker tag $(IMAGE):$(SUPERVISOR_VERSION) $(SUPERVISOR_REGISTRY)/$(IMAGE):$(SUPERVISOR_VERSION)
|
|
|
|
|
|
|
|
|
2014-07-10 19:54:29 +00:00
|
|
|
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)
|
|
|
|
endif
|
2014-07-18 13:57:46 +00:00
|
|
|
docker tag $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO):$(BUILDSTEP_VERSION) resin/supervisor-base:latest
|
2014-07-10 19:54:29 +00:00
|
|
|
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
|