2014-07-03 15:29:49 +00:00
|
|
|
DISABLE_CACHE = 'false'
|
|
|
|
|
2015-07-11 21:29:24 +00:00
|
|
|
ARCH = rpi# rpi/amd64/i386/armv7hf
|
2014-07-03 15:29:49 +00:00
|
|
|
|
2015-07-16 16:23:14 +00:00
|
|
|
DEPLOY_REGISTRY = registry.resindev.io/
|
2015-02-11 17:21:10 +00:00
|
|
|
|
2015-06-02 12:47:33 +00:00
|
|
|
SUPERVISOR_VERSION = master
|
2014-07-03 15:29:49 +00:00
|
|
|
|
|
|
|
all: supervisor
|
|
|
|
|
2015-02-03 17:10:37 +00:00
|
|
|
IMAGE = "resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION)"
|
2014-10-17 11:23:20 +00:00
|
|
|
|
2015-07-17 20:47:26 +00:00
|
|
|
ifeq ($(ARCH),rpi)
|
|
|
|
GOARCH = arm
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),armv7hf)
|
|
|
|
GOARCH = arm
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),i386)
|
|
|
|
GOARCH = 386
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
GOARCH = amd64
|
|
|
|
endif
|
|
|
|
|
2014-10-17 11:23:20 +00:00
|
|
|
clean:
|
2015-02-17 00:52:45 +00:00
|
|
|
-rm Dockerfile
|
2014-10-07 17:41:49 +00:00
|
|
|
|
2015-06-02 12:47:33 +00:00
|
|
|
supervisor-dind:
|
|
|
|
cd tools/dind && docker build --no-cache=$(DISABLE_CACHE) -t resin/resin-supervisor-dind:$(SUPERVISOR_VERSION) .
|
|
|
|
|
2015-07-16 20:12:09 +00:00
|
|
|
run-supervisor: supervisor-dind stop-supervisor
|
2015-06-02 12:47:33 +00:00
|
|
|
cd tools/dind \
|
2015-07-16 16:23:14 +00:00
|
|
|
&& sed --in-place -e "s|SUPERVISOR_IMAGE=.*|SUPERVISOR_IMAGE=$(DEPLOY_REGISTRY)$(IMAGE) |" config/env \
|
2015-06-02 12:47:33 +00:00
|
|
|
&& docker run -d --name resin_supervisor_1 --privileged -v $$(pwd)/config.json:/usr/src/app/config/config.json -v $$(pwd)/config/env:/usr/src/app/config/env -v /sys/fs/cgroup:/sys/fs/cgroup:ro resin/resin-supervisor-dind:$(SUPERVISOR_VERSION)
|
|
|
|
|
2015-07-16 16:23:14 +00:00
|
|
|
stop-supervisor:
|
2015-07-16 20:12:09 +00:00
|
|
|
-docker stop resin_supervisor_1 > /dev/null
|
|
|
|
# Remove volumes to prevent us from running out of loopback devices,
|
|
|
|
# as per https://github.com/jpetazzo/dind/issues/19
|
|
|
|
-docker rm -f --volumes resin_supervisor_1 > /dev/null
|
2015-07-16 16:23:14 +00:00
|
|
|
|
2015-07-23 17:00:37 +00:00
|
|
|
supervisor: gosuper
|
2014-10-17 12:21:47 +00:00
|
|
|
cp Dockerfile.$(ARCH) Dockerfile
|
|
|
|
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile
|
|
|
|
docker build --no-cache=$(DISABLE_CACHE) -t resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION) .
|
2015-02-20 16:08:18 +00:00
|
|
|
-rm Dockerfile
|
2014-07-03 15:29:49 +00:00
|
|
|
|
2015-02-11 17:21:10 +00:00
|
|
|
deploy: supervisor
|
2015-03-02 17:47:41 +00:00
|
|
|
docker tag -f $(IMAGE) $(DEPLOY_REGISTRY)$(IMAGE)
|
|
|
|
docker push $(DEPLOY_REGISTRY)$(IMAGE)
|
2015-02-11 17:21:10 +00:00
|
|
|
|
2015-07-17 20:47:26 +00:00
|
|
|
go-builder:
|
2015-07-23 17:00:37 +00:00
|
|
|
docker build -f Dockerfile.gosuper -t resin/go-supervisor-builder:$(SUPERVISOR_VERSION) .
|
2015-07-17 20:47:26 +00:00
|
|
|
|
|
|
|
gosuper: go-builder
|
2015-07-23 17:00:37 +00:00
|
|
|
-mkdir -p gosuper/bin
|
2015-07-24 20:59:58 +00:00
|
|
|
docker run --rm -v $(shell pwd)/gosuper/bin:/usr/src/app/bin -e USER_ID=$(shell id -u) -e GROUP_ID=$(shell id -g) -e GOARCH=$(GOARCH) resin/go-supervisor-builder:$(SUPERVISOR_VERSION)
|
2015-07-23 21:14:50 +00:00
|
|
|
|
|
|
|
test-gosuper: go-builder
|
2015-07-24 20:59:58 +00:00
|
|
|
docker run --rm -v $(shell pwd)/gosuper/bin:/usr/src/app/bin resin/go-supervisor-builder:$(SUPERVISOR_VERSION) bash -c "cd src/resin-supervisor && go test -v ./gosuper"
|
|
|
|
|
|
|
|
test-integration: run-supervisor go-builder
|
|
|
|
docker run --rm --net=host -e SUPERVISOR_IP="$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' resin_supervisor_1)" -v $(shell pwd)/gosuper/bin:/usr/src/app/bin resin/go-supervisor-builder:$(SUPERVISOR_VERSION) bash -c "cd src/resin-supervisor && go test -v ./supertest"
|
2015-07-17 20:47:26 +00:00
|
|
|
|
2015-06-02 12:47:33 +00:00
|
|
|
.PHONY: supervisor deploy supervisor-dind run-supervisor
|