aboutsummaryrefslogtreecommitdiff
path: root/deploy/post-receive.sample
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-17 19:55:36 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-17 19:55:36 +0200
commit380195f7cd5e57acf2c1cf2bc41069e6b0b979ed (patch)
tree32a88fb22a7fbe8f1fd5c105156d1f928c93950d /deploy/post-receive.sample
downloadbokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.tar.gz
bokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.zip
Initial commit: daemon, clients, docs, Docker deploy pipelinev0.1.0
Diffstat (limited to 'deploy/post-receive.sample')
-rw-r--r--deploy/post-receive.sample29
1 files changed, 29 insertions, 0 deletions
diff --git a/deploy/post-receive.sample b/deploy/post-receive.sample
new file mode 100644
index 0000000..a259c2a
--- /dev/null
+++ b/deploy/post-receive.sample
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Optional: auto-deploy when pushing to a bare repo on the host.
+#
+# The normal workflow is scripts/deploy.sh from the development machine; this
+# hook is for the variant where the host also has the toolchain and a working
+# checkout. Install as hooks/post-receive in the bare repo, make it
+# executable, and set WORK_TREE to a checkout whose origin is that bare repo.
+set -eu
+
+WORK_TREE="${WORK_TREE:-/srv/bokf/src}"
+DEPLOY_DIR="${DEPLOY_DIR:-/srv/bokf}"
+BRANCH="${BRANCH:-refs/heads/main}"
+
+while read -r _old _new ref; do
+ [ "$ref" = "$BRANCH" ] || continue
+ cd "$WORK_TREE"
+ git pull --ff-only
+ make -j"$(nproc)"
+ make test
+ tag="$(git describe --tags --always)"
+ docker build -t "bokf:$tag" .
+ cp compose.yaml "$DEPLOY_DIR/compose.yaml"
+ touch "$DEPLOY_DIR/.env"
+ sed -i '/^BOKF_IMAGE=/d;/^BOKF_TAG=/d' "$DEPLOY_DIR/.env"
+ printf 'BOKF_IMAGE=bokf\nBOKF_TAG=%s\n' "$tag" >> "$DEPLOY_DIR/.env"
+ cd "$DEPLOY_DIR"
+ docker compose up -d --no-build
+ docker compose ps
+done