From c388e99a99dd102e19c11768c6fe72c6b1f31efd Mon Sep 17 00:00:00 2001 From: Joshua Rich Date: Sat, 6 Jan 2024 13:22:50 +1000 Subject: [PATCH] docs(README,development/README): update docs for container usage/development --- README.md | 32 ++++++++++++++++---------------- docs/development/README.md | 12 +++++++++++- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 625690dd2..4bfe4e73e 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ to other operating systems. See development information in the ## ⬇️ Installation +### Packages + Head over to the [releases](https://github.com/joshuar/go-hass-agent/releases) page and download the appropriate package for your operating system and/or distribution: @@ -96,6 +98,13 @@ following for the `rpm` package can be used: cosign verify-blob --key cosign.pub --signature go-hass-agent-*.rpm.sig go-hass-agent-*.rpm ``` +### Container + +Container images are available on +[ghcr.io](https://github.com/joshuar/go-hass-agent/pkgs/container/go-hass-agent). +Note that it is recommended to use an image tagged with the latest release version over +the latest container image, which might be unstable. + ## 🖱️ Usage Go Hass Agent runs as a tray icon by default. It is operating system, @@ -146,33 +155,24 @@ specifying the `--terminal` command-line option. ### Running in a container -There is rough support for running Go Hass Agent within a container. A -Dockerfile that you can use to build an image can be found -[here](build/package/Dockerfile). - -You can build an image with a command like the following (using Podman): - -```shell -cat Dockerfile | podman build --build-arg version='x.x.x' --network host --tag go-hass-agent - -``` +There is rough support for running Go Hass Agent within a container. Pre-built +images [are available](https://github.com/joshuar/go-hass-agent/pkgs/container/go-hass-agent). -The `--build-arg version=x.x.x` is required and the version should correspond to -a [release](releases/). Once the image is built, first register the agent with -Home Assistant: +To register the agent running in a container, run the following: ```shell -podman run --rm --hostname hass-container --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro --volume /run/user/1000/bus:/run/user/1000/bus:ro --volume ~/go-hass-agent:/home/go-hass-agent:U --network host --userns keep-id go-hass-agent register --server some.server:port --token longlivedtoken +podman run --hostname hass-container --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro --volume /run/user/1000/bus:/run/user/1000/bus:ro --volume ~/go-hass-agent:/home/go-hass-agent:U --network host --userns keep-id go-hass-agent register --server some.server:port --token longlivedtoken ``` Once registered, run the agent with: ```shell -podman run --rm --hostname hass-container --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro --volume /run/user/1000/bus:/run/user/1000/bus:ro --volume ~/go-hass-agent:/home/go-hass-agent:U --network host --userns keep-id go-hass-agent +podman run --hostname hass-container --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro --volume /run/user/1000/bus:/run/user/1000/bus:ro --volume ~/go-hass-agent:/home/go-hass-agent:U --network host --userns keep-id go-hass-agent ``` You can change `~/go-hass-agent` to whatever volume you want to use to store the agent config -and registry. The D-Bus volumes are optional, not specifying them will mean -sensors that rely on a D-Bus connection will not show up. +and registry. All of the volume mounts are optional, but functionality and the +sensors reported will be severely limited without them. ### Regular Usage diff --git a/docs/development/README.md b/docs/development/README.md index e9226027c..6ca8da3aa 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -55,7 +55,7 @@ go generate ./... go build ``` -## Packaging +### Packages Go Hass Agent uses [Goreleaser](https://goreleaser.com/intro/) to create packages for Fedora, Arch and Ubuntu and @@ -81,6 +81,16 @@ fyne-cross linux -icon assets/trayicon/logo-pretty.png -release The `.tar.xz` will be available under `fyne-cross/dist/linux-amd64/`. +### Container Images + +A Dockerfile that you can use to build an image can be found [here](../../Dockerfile). + +You can build an image with a command like the following (using Podman): + +```shell +podman build --file ./Dockerfile --network host --tag go-hass-agent +``` + ## Committing Code This repository is using [conventional commit