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-08-01 14:10:42 +00:00
|
|
|
# This allows using a cache for building the supervisor, making it much faster.
|
|
|
|
CACHE_VOLUME = # --volume /home/vagrant/cache:/cache
|
|
|
|
|
2014-07-03 15:29:49 +00:00
|
|
|
all: supervisor
|
|
|
|
|
2014-07-18 13:58:49 +00:00
|
|
|
BUILDSTEP_PRESENT = $(shell docker images --all | grep $(BUILDSTEP_VERSION) | awk '{print $$1}' | grep -xF $(BUILDSTEP_REGISTRY)/$(BUILDSTEP_REPO) )
|
2014-07-10 19:54:29 +00:00
|
|
|
|
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-08-18 12:09:04 +00:00
|
|
|
ACCELERATOR = $(shell docker ps --all | grep buildstep-accelerator-$(BUILDSTEP_VERSION) | awk '{print $$1}' )
|
2014-07-10 19:54:29 +00:00
|
|
|
|
|
|
|
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-29 14:21:17 +00:00
|
|
|
docker rm -f build-supervisor-latest 2> /dev/null || true
|
2014-08-18 12:09:04 +00:00
|
|
|
docker run --name build-supervisor-latest $(CACHE_VOLUME) --volumes-from $(ACCELERATOR):ro -v `pwd`:/tmp/app resin/supervisor-base:latest bash -i -c ". /.env && cp -r /tmp/app /app && /build/builder"
|
2014-07-18 15:06:56 +00:00
|
|
|
docker commit build-supervisor-latest $(IMAGE):$(SUPERVISOR_VERSION) > /dev/null
|
|
|
|
docker tag $(IMAGE):$(SUPERVISOR_VERSION) $(SUPERVISOR_REGISTRY)/$(IMAGE):$(SUPERVISOR_VERSION)
|
2014-07-10 19:54:29 +00:00
|
|
|
else
|
|
|
|
supervisor-accelerated:
|
|
|
|
echo 'Please run make accelerator in resin-buildstep to continue'
|
|
|
|
endif
|
|
|
|
|
2014-09-22 12:45:15 +00:00
|
|
|
supervisor-x86_64:
|
|
|
|
tar --exclude="Dockerfile" --transform='flags=r;s|Dockerfile.x86_64|Dockerfile|' -c . | docker build -t resin/x86_64-supervisor -
|
2014-07-10 19:54:29 +00:00
|
|
|
|
2014-09-22 12:45:15 +00:00
|
|
|
run-supervisor-x86_64:
|
|
|
|
docker run --privileged -d -v /var/run/docker.sock:/run/docker.sock -e API_ENDPOINT=https://staging.resin.io -e REGISTRY_ENDPOINT=registry.staging.resin.io -e PUBNUB_SUBSCRIBE_KEY=sub-c-bananas -e PUBNUB_PUBLISH_KEY=pub-c-bananas -e MIXPANEL_TOKEN=bananasbananas resin/x86_64-supervisor /start
|
2014-08-05 14:18:19 +00:00
|
|
|
|
2014-09-22 12:45:15 +00:00
|
|
|
supervisor-i386:
|
|
|
|
tar --exclude="Dockerfile" --transform='flags=r;s|Dockerfile.i386|Dockerfile|' -c . | docker build -t resin/i386-supervisor -
|
|
|
|
|
|
|
|
run-supervisor-i386:
|
|
|
|
docker run --privileged -d -v /var/run/docker.sock:/run/docker.sock -e API_ENDPOINT=https://staging.resin.io -e REGISTRY_ENDPOINT=registry.staging.resin.io -e PUBNUB_SUBSCRIBE_KEY=sub-c-bananas -e PUBNUB_PUBLISH_KEY=pub-c-bananas -e MIXPANEL_TOKEN=bananasbananas resin/i386-supervisor /start
|
|
|
|
|
|
|
|
.PHONY: supervisor supervisor-accelerated supervisor-x86_64 run-supervisor-x86_64 supervisor-i386 run-supervisor-i386
|