From e8a5fa1413a39dd4b9cd612b86aff331d39a8030 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 24 Sep 2014 22:36:52 -0500 Subject: [PATCH] Dockerfile integrated in main repo --- Dockerfile | 11 +++++++++++ start.py | 19 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..4523ecfd855 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3-onbuild +MAINTAINER Paulus Schoutsen + +# Initialize the submodules +RUN git submodule init && git submodule update --recursive + +VOLUME /config + +EXPOSE 8123 + +CMD [ "python", "./start.py", "--docker" ] diff --git a/start.py b/start.py index 61e4575d2f5..246e83ab389 100644 --- a/start.py +++ b/start.py @@ -1,8 +1,23 @@ -""" Starts home assistant with all possible functionality. """ +""" Starts home assistant. """ + +import sys +import os import homeassistant import homeassistant.bootstrap -hass = homeassistant.bootstrap.from_config_file("config/home-assistant.conf") +# Within Docker we load the config from a different path +if '--docker' in sys.argv: + config_path = '/config/home-assistant.conf' +else: + config_path = 'config/home-assistant.conf' + +# Ensure a config file exists to make first time usage easier +if not os.path.isfile(config_path): + with open(config_path, 'w') as conf: + conf.write("[http]\n") + conf.write("api_password=password\n") + +hass = homeassistant.bootstrap.from_config_file(config_path) hass.start() hass.block_till_stopped()