Site updated at 2017-05-15 23:19:06 UTC

This commit is contained in:
Travis CI 2017-05-15 23:19:06 +00:00
parent 2c31673a27
commit 372fd6d0fe
26 changed files with 46 additions and 42 deletions

View file

@ -85,10 +85,9 @@
</code></pre>
</div>
<h2><a class="title-link" name="add-on-docker-file" href="#add-on-docker-file"></a> Add-on Docker file</h2>
<p>All add-ons are based on Alpine Linux 3.5. Hass.io will automatically substitute the right base image based on the machine architecture. The Dockerfile is also required to have a VERSION environment variable which we will substitute with the version of the add-on.</p>
<p>All add-ons are based on Alpine Linux 3.5. Hass.io will automatically substitute the right base image based on the machine architecture.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>FROM %%BASE_IMAGE%%
ENV VERSION %%VERSION%%
ENV LANG C.UTF-8
# Install requirements for add-on
@ -101,6 +100,10 @@ RUN chmod a+x /run.sh
CMD [ "/run.sh" ]
</code></pre>
</div>
<p>If you dont use local build on device or our build script, make sure that the Dockerfile have also a set of labels include:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>LABEL io.hass.version="VERSION" io.hass.type="addon" io.hass.arch="armhf|aarch64|i386|amd64"
</code></pre>
</div>
<h2><a class="title-link" name="add-on-config" href="#add-on-config"></a> Add-on config</h2>
<p>The config for an add-on is stored in <code class="highlighter-rouge">config.json</code>.</p>
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">

View file

@ -70,14 +70,15 @@
<p>The fastest way to develop add-ons is by adding them to your local add-on repository. To access your local add-on repository, install either the <a href="/addons/samba/">Samba add-on</a> or <a href="/addons/ssh/">SSH add-on</a>.</p>
<p>Right now add-ons will work with images that are stored on Docker Hub (using <code class="highlighter-rouge">image</code> from add-on config). Without <code class="highlighter-rouge">image</code> inside local add-ons repository it to be built on the device.</p>
<h2><a class="title-link" name="local-run" href="#local-run"></a> Local run</h2>
<p>You can build an try the addon on your developer machine also. Move all addon stuff into a temp folder. Replace in the Dockerfile: <code class="highlighter-rouge">%%VERSION%%</code> with your version and <code class="highlighter-rouge">%%BASE_IMAGE%%</code> with:</p>
<p>You can build an try the addon on your developer machine also. Move all addon stuff into a temp folder. Replace in the Dockerfile <code class="highlighter-rouge">%%BASE_IMAGE%%</code> with:</p>
<ul>
<li>armhf: <code class="highlighter-rouge">resin/armhf-alpine:3.5</code></li>
<li>aarch64: <code class="highlighter-rouge">resin/aarch64-alpine:3.5</code></li>
<li>amd64: <code class="highlighter-rouge">resin/amd64-alpine:3.5</code></li>
<li>i386: <code class="highlighter-rouge">resin/i386-alpine:3.5</code></li>
</ul>
<p>Use <code class="highlighter-rouge">docker</code> to build the test addon: <code class="highlighter-rouge">docker build -t local/my-test-addon .</code></p>
<p>Add also a <code class="highlighter-rouge">LABEL io.hass.version="xy"</code> into your dockerfile.
Use <code class="highlighter-rouge">docker</code> to build the test addon: <code class="highlighter-rouge">docker build -t local/my-test-addon .</code></p>
<p>Create a new folder for data and add a test <em>options.json</em> file. After that you can run your add-on with: <code class="highlighter-rouge">docker run --rm -v /tmp/my_test_data:/data -p PORT_STUFF_IF_NEEDED local/my-test-addon</code></p>
<h2><a class="title-link" name="logs" href="#logs"></a> Logs</h2>
<p>All stdout and stderr is redirected to the Docker logs. The logs can be fetched from the add-on page inside the Hass.io panel in Home Assistant.</p>