diff --git a/.devcontainer/start_ha.sh b/.devcontainer/start_ha.sh old mode 100644 new mode 100755 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..f7f9686 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,18 @@ +# Local Development + +To get the addon to run locally, make these changes but do not commit them to any PR + +## Add the `ARCH` arg to the `build.json` file: + +```json +{ + "args": { + "TESLAMATE_TAG": "1.21.2", + "ARCH": "amd64" + } +} +``` + +## Remove the `image` key from `config.json` + +This will make Home Assistant build the container every time. diff --git a/Dockerfile b/Dockerfile index c6d65fa..7b6e566 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,28 +7,43 @@ FROM teslamate/grafana:${TESLAMATE_TAG} as grafana FROM teslamate/teslamate:${TESLAMATE_TAG} ARG ARCH -ARG BASHIO_VERSION=0.9.0 -ARG S6_OVERLAY_VERSION=1.22.1.0 +ARG BASHIO_VERSION=0.11.0 +ARG S6_OVERLAY_VERSION=2.1.0.2 + +ENV \ + DEBIAN_FRONTEND="noninteractive" \ + LANG="C.UTF-8" \ + S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ + S6_CMD_WAIT_FOR_SERVICES=1 USER root -# Install bashio - from https://github.com/home-assistant/docker-base/blob/master/alpine/amd64/Dockerfile -RUN apk add --no-cache \ +# Commands taken from HA Ubuntu base Dockerfile but switched to wget as curl didn't work using buildx +# https://github.com/home-assistant/docker-base/blob/master/ubuntu/amd64/Dockerfile +RUN \ + set -x \ + && apt-get update && apt-get install -y --no-install-recommends \ bash \ - jq \ - tzdata \ + bind9utils \ ca-certificates \ curl \ - bind-tools \ - nginx \ - \ - && curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${ARCH}.tar.gz" \ - | tar zxvf - -C / \ + jq \ + libnginx-mod-http-subs-filter \ + nginx-light \ + tzdata \ + wget \ + && rm -rf /var/lib/apt/lists/* \ + \ + && wget https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${ARCH}.tar.gz \ + && tar zxvf s6-overlay-${ARCH}.tar.gz -C / \ + && rm -f s6-overlay-${ARCH}.tar.gz \ && mkdir -p /etc/fix-attrs.d \ && mkdir -p /etc/services.d \ \ && mkdir -p /tmp/bashio \ - && curl -L -s https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz | tar -xzf - --strip 1 -C /tmp/bashio \ + && wget https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz \ + && tar xvzf v${BASHIO_VERSION}.tar.gz --strip 1 -C /tmp/bashio \ + && rm -f v${BASHIO_VERSION}.tar.gz \ && mv /tmp/bashio/lib /usr/lib/bashio \ && ln -s /usr/lib/bashio/bashio /usr/bin/bashio \ && rm -rf /tmp/bashio @@ -47,6 +62,5 @@ COPY --chown=root services/nginx/teslamate.conf /etc/nginx/conf.d/ COPY --from=grafana --chown=root /dashboards /dashboards COPY --from=grafana --chown=root /dashboards_internal /dashboards -# USER nobody - +# S6-Overlay ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/build.json b/build.json index ee788ea..df423b8 100644 --- a/build.json +++ b/build.json @@ -1,5 +1,5 @@ { "args": { - "TESLAMATE_TAG": "1.21.1" + "TESLAMATE_TAG": "1.21.3" } } \ No newline at end of file diff --git a/services/nginx/teslamate.conf b/services/nginx/teslamate.conf index f8b8b52..dfe9ed0 100644 --- a/services/nginx/teslamate.conf +++ b/services/nginx/teslamate.conf @@ -1,6 +1,3 @@ -# Enable gzipping of responses. -gzip on; - map $http_upgrade $connection_upgrade { default upgrade; '' close;