diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..804723eec1de15bbf9ec807ddc1fee66e45b906d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM k8s.gcr.io/git-sync/git-sync:v3.3.5 + +ENV GIT_SYNC_ROOT='/tmp/git' GIT_SYNC_DEST='config' GIT_SYNC_EXECHOOK_COMMAND='/ha-rsync' GIT_SYNC_ADD_USER='true' + +USER root:root + +RUN set -ex \ + && apt update -y \ + && apt install -y rsync \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* \ + && chmod -Rv 0777 "${GIT_SYNC_ROOT:-/tmp/git}/" + +COPY ha-rsync* / + +RUN set -ex \ + && chmod a+x /ha-rsync + +VOLUME ["/config"] + +USER git-sync:git-sync diff --git a/ha-rsync b/ha-rsync new file mode 100644 index 0000000000000000000000000000000000000000..b424cca0d22cc24c96d5925342f3c703089139d0 --- /dev/null +++ b/ha-rsync @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +rsync -a \ + --exclude-from='/ha-rsync.excludes' \ + --delete-after \ + "${GIT_SYNC_ROOT:-/tmp/git}/${GIT_SYNC_DEST:-config}/" \ + /config diff --git a/ha-rsync.excludes b/ha-rsync.excludes new file mode 100644 index 0000000000000000000000000000000000000000..0db410cefd755fe7d0868fa4efc3aa81d5b5be06 --- /dev/null +++ b/ha-rsync.excludes @@ -0,0 +1,16 @@ +/.git +/.gitignore +/README.md + +/deps +/image +/tts + +.HA_VERSION + +/.cloud/* +/.storage/* + +/automations.yaml +/scenes.yaml +/scripts.yaml