From e6132abf0e59315da9765c2628228f2f95ccef0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 23 Oct 2020 13:41:02 +0200 Subject: [PATCH] Restructure README (#54) * Restructure README * rename * Apply suggestions from code review Co-authored-by: Franck Nijhof Co-authored-by: Franck Nijhof --- .github/workflows/hadolint.yml | 2 + .github/workflows/shellcheck.yml | 4 +- README.md | 201 ++++++++++++++++++++++++------- 3 files changed, 162 insertions(+), 45 deletions(-) diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index b96154a..e621bd7 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -1,9 +1,11 @@ name: hadolint + on: push: branches: - master pull_request: + jobs: hadolint: name: lint diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index b34c077..590b081 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,11 +1,11 @@ +name: 'Shellcheck' + on: push: branch: - master pull_request: -name: 'Trigger: Push action' - jobs: shellcheck: name: Shellcheck diff --git a/README.md b/README.md index 1651823..45eaac8 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,12 @@ -# Build docker env +# Home Assistant builder -## Install - -amd64: -```bash -$ docker pull homeassistant/amd64-builder -``` - -armv7/armhf: -```bash -$ docker pull homeassistant/armv7-builder -``` - -aarch64: -```bash -$ docker pull homeassistant/aarch64-builder -``` - -## Run - -GIT repository: -```bash -$ docker run --rm --privileged -v ~/.docker:/root/.docker homeassistant/amd64-builder --all -t addon-folder -r https://github.com/xy/addons -b branchname -``` - -Local repository: -```bash -docker run --rm --privileged -v ~/.docker:/root/.docker -v /my_addon:/data homeassistant/amd64-builder --all -t /data -``` - -## Docker Daemon -By default the image will run docker-in-docker. You can use the host docker daemon by bind mounting the host docker socket to `/var/run/docker.sock` inside the container. For example, to do this with the _Local repository_ example above (assuming the host docker socket is at `/var/run/docker.sock`: - -```bash -docker run --rm --privileged -v ~/.docker:/root/.docker -v /var/run/docker.sock:/var/run/docker.sock:ro -v /my_addon:/data homeassistant/amd64-builder --all -t /data -``` - -## Help - -```bash -$ docker run --rm --privileged homeassistant/amd64-builder --help -``` +_Multi-purpose cross-compile docker builder._ ## GitHub Action You can use this repository as a GitHub action to test and/or publish your builds. -Use the `with.args` key to pass in arguments to the builder, to see what arguments are supported you can run the [help](#help) or look in the [builder.sh file](./builder.sh) +Use the `with.args` key to pass in arguments to the builder, to see what arguments are supported you can look at the [arguments](#Arguments) section. ### Test action example @@ -101,3 +61,158 @@ jobs: --target /data \ --docker-hub userspace-name ``` + +## Arguments + +``` +Options: +-h, --help + Display this help and exit. + +Repository / Data + -r, --repository + Set git repository to load data from. + -b, --branch + Set git branch for repository. + -t, --target + Set local folder or path inside repository for build. + +Version/Image handling + -v, --version + Overwrite version/tag of build. + -i, --image + Overwrite image name of build / support {arch}. + --release + Additional version information like for base images. + --release-tag + Use this as main tag. + +Architecture + --armhf + Build for arm v6. + --armv7 + Build for arm v7. + --amd64 + Build for intel/amd 64bit. + --aarch64 + Build for arm 64bit. + --i386 + Build for intel/amd 32bit. + --all + Build all architecture. + +Build handling + --test + Disable push to dockerhub. + --no-latest + Do not tag images as latest. + --no-cache + Disable cache for the build (from latest). + --self-cache + Use same tag as cache tag instead latest. + --cache-tag + Use a custom tag for the build cache. + -d, --docker-hub + Set or overwrite the docker repository. + --docker-hub-check + Check if the version already exists before starting the build. + --docker-user + Username to login into docker with + --docker-password + Password to login into docker with + --no-crossbuild-cleanup + Don't cleanup the crosscompile feature (for multiple builds) + + Use the host docker socket if mapped into container: + /var/run/docker.sock + +Internals: + --addon + Default on. Run all things for an addon build. + --generic + Build based on the build.json + --builder-wheels + Build the wheels builder for Home Assistant. + --base + Build our base images. + --base-python + Build our base python images. + --base-raspbian + Build our base raspbian images. + --base-ubuntu + Build our base ubuntu images. + --base-debian + Build our base debian images. + --homeassisant-landingpage + Build the landingpage for machines. + --homeassistant-machine + Build the machine based image for a release. +``` + +## Local installation + +amd64: +```bash +docker pull homeassistant/amd64-builder +``` + +armv7/armhf: +```bash +docker pull homeassistant/armv7-builder +``` + +aarch64: +```bash +docker pull homeassistant/aarch64-builder +``` + +## Run + +**For remote git repository:** + +```bash +docker run \ + --rm \ + --privileged \ + -v ~/.docker:/root/.docker \ + homeassistant/amd64-builder \ + --all \ + -t addon-folder \ + -r https://github.com/xy/addons \ + -b branchname +``` + +**For local git repository:** + +```bash +docker run \ + --rm \ + --privileged \ + -v ~/.docker:/root/.docker \ + -v /my_addon:/data \ + homeassistant/amd64-builder \ + --all \ + -t /data +``` + +## Docker Daemon + +By default, the image will run docker-in-docker. You can use the host docker daemon by bind mounting the host docker socket to `/var/run/docker.sock` inside the container. For example, to do this with the _Local repository_ example above (assuming the host docker socket is at `/var/run/docker.sock`: + +```bash +docker run \ + --rm \ + --privileged \ + -v ~/.docker:/root/.docker \ + -v /var/run/docker.sock:/var/run/docker.sock:ro \ + -v /my_addon:/data \ + homeassistant/amd64-builder \ + --all \ + -t /data +``` + +## Help + +```bash +docker run --rm --privileged homeassistant/amd64-builder --help +```