From 648661877af572ba155a06d1b2985f88be86d3a4 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 29 Jul 2021 20:32:18 +0100 Subject: [PATCH] Add watchtower hooks --- packages/server/.gitignore | 1 + packages/server/Dockerfile | 5 +++++ packages/server/scripts/watchtower-hooks/post-check.sh | 1 + packages/server/scripts/watchtower-hooks/post-update.sh | 1 + packages/server/scripts/watchtower-hooks/pre-check.sh | 1 + packages/server/scripts/watchtower-hooks/pre-update.sh | 1 + packages/worker/.gitignore | 1 + packages/worker/Dockerfile | 5 +++++ packages/worker/scripts/watchtower-hooks/post-check.sh | 1 + packages/worker/scripts/watchtower-hooks/post-update.sh | 1 + packages/worker/scripts/watchtower-hooks/pre-check.sh | 1 + packages/worker/scripts/watchtower-hooks/pre-update.sh | 1 + 12 files changed, 20 insertions(+) create mode 100755 packages/server/scripts/watchtower-hooks/post-check.sh create mode 100755 packages/server/scripts/watchtower-hooks/post-update.sh create mode 100755 packages/server/scripts/watchtower-hooks/pre-check.sh create mode 100755 packages/server/scripts/watchtower-hooks/pre-update.sh create mode 100755 packages/worker/scripts/watchtower-hooks/post-check.sh create mode 100755 packages/worker/scripts/watchtower-hooks/post-update.sh create mode 100755 packages/worker/scripts/watchtower-hooks/pre-check.sh create mode 100755 packages/worker/scripts/watchtower-hooks/pre-update.sh diff --git a/packages/server/.gitignore b/packages/server/.gitignore index e8589f631d..48207e3dd4 100644 --- a/packages/server/.gitignore +++ b/packages/server/.gitignore @@ -7,3 +7,4 @@ public/ db/dev.db/ dist coverage/ +watchtower-hook.json \ No newline at end of file diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index 253bcb339d..b2e4efadb9 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,5 +1,10 @@ FROM node:12-alpine +LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh" + WORKDIR /app ENV PORT=4001 diff --git a/packages/server/scripts/watchtower-hooks/post-check.sh b/packages/server/scripts/watchtower-hooks/post-check.sh new file mode 100755 index 0000000000..df95917d98 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/post-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/post-update.sh b/packages/server/scripts/watchtower-hooks/post-update.sh new file mode 100755 index 0000000000..fe57719781 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/post-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/pre-check.sh b/packages/server/scripts/watchtower-hooks/pre-check.sh new file mode 100755 index 0000000000..ffaa41ad5f --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/pre-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/server/scripts/watchtower-hooks/pre-update.sh b/packages/server/scripts/watchtower-hooks/pre-update.sh new file mode 100755 index 0000000000..4584d96fc9 --- /dev/null +++ b/packages/server/scripts/watchtower-hooks/pre-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/.gitignore b/packages/worker/.gitignore index 713d5006da..0467f6a505 100644 --- a/packages/worker/.gitignore +++ b/packages/worker/.gitignore @@ -1,2 +1,3 @@ node_modules/ .env +watchtower-hook.json \ No newline at end of file diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 76b35dfdd0..517e24678f 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -1,5 +1,10 @@ FROM node:12-alpine +LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh" +LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh" + WORKDIR /app # copy files and install dependencies diff --git a/packages/worker/scripts/watchtower-hooks/post-check.sh b/packages/worker/scripts/watchtower-hooks/post-check.sh new file mode 100755 index 0000000000..df95917d98 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/post-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/post-update.sh b/packages/worker/scripts/watchtower-hooks/post-update.sh new file mode 100755 index 0000000000..fe57719781 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/post-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "post-update" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/pre-check.sh b/packages/worker/scripts/watchtower-hooks/pre-check.sh new file mode 100755 index 0000000000..ffaa41ad5f --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/pre-check.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-check" }' > 'watchtower-hook.json' \ No newline at end of file diff --git a/packages/worker/scripts/watchtower-hooks/pre-update.sh b/packages/worker/scripts/watchtower-hooks/pre-update.sh new file mode 100755 index 0000000000..4584d96fc9 --- /dev/null +++ b/packages/worker/scripts/watchtower-hooks/pre-update.sh @@ -0,0 +1 @@ +echo '{ "current-hook" : "pre-update" }' > 'watchtower-hook.json' \ No newline at end of file