diff --git a/.dockerignore b/.dockerignore index 3d8c32cfb926efb575e7d92a0770e4bf27b09637..8144367ede15617580b1cb0ca423e371d7790329 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,9 +2,15 @@ .git .github config +docs + +# Development +.devcontainer +.vscode # Test related files .tox +tests # Other virtualization methods venv diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8853314ae806c034b498b98f248b4115f1afdba9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +ARG BUILD_FROM +FROM ${BUILD_FROM}:6.1.0 + +WORKDIR /usr/src + +## Setup Home Assistant +COPY . homeassistant/ +RUN pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + -r homeassistant/requirements_all.txt -c homeassistant/homeassistant/package_constraints.txt \ + && pip3 install --no-cache-dir --no-index --only-binary=:all: --find-links "${WHEELS_LINKS}" \ + -e ./homeassistant \ + && python3 -m compileall homeassistant/homeassistant + +# Home Assistant S6-Overlay +COPY rootfs / + +WORKDIR /config diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index 34827897749c36b986e50646d25f38d34ca0b69b..7bf8e3ddfb23e2b0875bd38a6b1e2b561518adf7 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -14,7 +14,7 @@ schedules: always: true variables: - name: versionBuilder - value: '6.9' + value: '7.2.0' - group: docker - group: github - group: twine @@ -108,11 +108,9 @@ stages: docker run --rm --privileged \ -v ~/.docker:/root/.docker:rw \ -v /run/docker.sock:/run/docker.sock:rw \ - -v $(pwd):/homeassistant:ro \ + -v $(pwd):/data:ro \ homeassistant/amd64-builder:$(versionBuilder) \ - --homeassistant $(homeassistantRelease) "--$(buildArch)" \ - -r https://github.com/home-assistant/hassio-homeassistant \ - -t generic --docker-hub homeassistant + --generic $(homeassistantRelease) "--$(buildArch)" -t /data \ docker run --rm --privileged \ -v ~/.docker:/root/.docker \ diff --git a/build.json b/build.json new file mode 100644 index 0000000000000000000000000000000000000000..c61a693af1cff8554b2dab065da7e80a5418668c --- /dev/null +++ b/build.json @@ -0,0 +1,14 @@ +{ + "image": "homeassistant/{arch}-homeassistant", + "build_from": { + "aarch64": "homeassistant/aarch64-homeassistant-base:7.0.1", + "armhf": "homeassistant/armhf-homeassistant-base:7.0.1", + "armv7": "homeassistant/armv7-homeassistant-base:7.0.1", + "amd64": "homeassistant/amd64-homeassistant-base:7.0.1", + "i386": "homeassistant/i386-homeassistant-base:7.0.1" + }, + "labels": { + "io.hass.type": "core" + }, + "version_tag": true +} diff --git a/rootfs/etc/services.d/home-assistant/finish b/rootfs/etc/services.d/home-assistant/finish new file mode 100644 index 0000000000000000000000000000000000000000..84b7abcab8b28c7366735591263e73010e9a2448 --- /dev/null +++ b/rootfs/etc/services.d/home-assistant/finish @@ -0,0 +1,5 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Take down the S6 supervision tree when Home Assistant fails +# ============================================================================== +s6-svscanctl -t /var/run/s6/services \ No newline at end of file diff --git a/rootfs/etc/services.d/home-assistant/run b/rootfs/etc/services.d/home-assistant/run new file mode 100644 index 0000000000000000000000000000000000000000..a153db56b6173ac868847f3be8e6e20e93bddf63 --- /dev/null +++ b/rootfs/etc/services.d/home-assistant/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Start Home Assistant service +# ============================================================================== +cd /config || bashio::exit.nok "Can't find config folder!" + +exec python3 -m homeassistant --config /config