home-assistant/Makefile

30 lines
677 B
Makefile

IMAGE = homeassistant/home-assistant
CONTAINER = home-assistant
HA_VERSION = $(shell cat .HA_VERSION)
HASS_BIN = python -m homeassistant
VOLUMES = $(PWD):/config /etc/localtime:/etc/localtime:ro
HASS = docker run -it --rm \
$(addprefix -v ,$(VOLUMES)) \
$(IMAGE) $(HASS_BIN) \
--config /config
.PHONY: test
test:
@$(HASS) --script check_config --files
.PHONY: run stop destroy pull deploy upgrade
run:
docker run -d \
--name $(CONTAINER) \
$(addprefix -v ,$(VOLUMES)) \
--net=host \
$(IMAGE):$(HA_VERSION)
stop:
docker stop $(CONTAINER)
destroy:
docker rm -f $(CONTAINER)
pull:
docker pull $(IMAGE):$(HA_VERSION)
deploy: test destroy run
upgrade: pull deploy