From 87c8fce5fd631ba94c415fd242af80b4423ed9e1 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:36:21 +0100 Subject: [PATCH 01/12] add dockerfile for webhook server --- webhook_application_dockerfile | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webhook_application_dockerfile diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile new file mode 100644 index 0000000..71c3e51 --- /dev/null +++ b/webhook_application_dockerfile @@ -0,0 +1,38 @@ +FROM alpine:3.20 + +ARG VERSION + +LABEL version="${VERSION}" \ + Maintainer="H2 invent GmbH" \ + Description="Webhook Server" \ + org.opencontainers.version="${VERSION}" \ + org.opencontainers.image.title="Webhook Server" \ + org.opencontainers.image.vendor="H2 invent GmbH" \ + org.opencontainers.image.authors="Andreas Holzmann " \ + org.opencontainers.image.documentation="https://h2-invent.com" \ + org.opencontainers.image.url="https://h2-invent.com" + +RUN apk --no-cache add \ + git \ + curl \ + jq \ + && rm -rf /var/cache/apk/* + +RUN addgroup -S webhook \ + && adduser -S webhook -G webhook + +WORKDIR /opt/webhook + +RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ + && tar --strip-components=1 -xvzf artifact.tar.gz \ + && chmod +x webhook \ + rm artifact.tar.gz + +RUN echo "- id: whoami-webhook" > hooks.yaml \ + && echo " execute-command: 'whoami'" >> hooks.yaml + +EXPOSE 9000 + +USER webhook + +ENTRYPOINT ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 37c44910d68aecae19727b6be9e314d4cfcfb8f5 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:41:23 +0100 Subject: [PATCH 02/12] update --- webhook_application_dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 71c3e51..45a5feb 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -25,6 +25,7 @@ WORKDIR /opt/webhook RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ && tar --strip-components=1 -xvzf artifact.tar.gz \ + && ls -ls \ && chmod +x webhook \ rm artifact.tar.gz -- 2.39.5 From 19de33360140a2ae5d7e99935d464636a6141096 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:42:56 +0100 Subject: [PATCH 03/12] update --- webhook_application_dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 45a5feb..ee6af55 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -26,7 +26,7 @@ WORKDIR /opt/webhook RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ && tar --strip-components=1 -xvzf artifact.tar.gz \ && ls -ls \ - && chmod +x webhook \ + && chmod +x webhook-linux-amd64/webhook \ rm artifact.tar.gz RUN echo "- id: whoami-webhook" > hooks.yaml \ @@ -36,4 +36,4 @@ EXPOSE 9000 USER webhook -ENTRYPOINT ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +ENTRYPOINT ['/opt/webhook/webhook-linux-amd64/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From fb371802f9d8b3418c3664bbb3d05ae2e1fd6edc Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:44:02 +0100 Subject: [PATCH 04/12] ls --- webhook_application_dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index ee6af55..4342d2d 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -25,9 +25,7 @@ WORKDIR /opt/webhook RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ && tar --strip-components=1 -xvzf artifact.tar.gz \ - && ls -ls \ - && chmod +x webhook-linux-amd64/webhook \ - rm artifact.tar.gz + && ls -ls RUN echo "- id: whoami-webhook" > hooks.yaml \ && echo " execute-command: 'whoami'" >> hooks.yaml -- 2.39.5 From ab984c6fdb03634ffd532ae23d277bd760d9b72d Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:45:30 +0100 Subject: [PATCH 05/12] fix permission --- webhook_application_dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 4342d2d..fd65d9b 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -25,7 +25,8 @@ WORKDIR /opt/webhook RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ && tar --strip-components=1 -xvzf artifact.tar.gz \ - && ls -ls + && ls -ls \ + && rm artifact.tar.gz RUN echo "- id: whoami-webhook" > hooks.yaml \ && echo " execute-command: 'whoami'" >> hooks.yaml @@ -34,4 +35,4 @@ EXPOSE 9000 USER webhook -ENTRYPOINT ['/opt/webhook/webhook-linux-amd64/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +ENTRYPOINT ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 4816f4b3b8f70f63576dbbacbd10d684ab9ce445 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Wed, 18 Dec 2024 17:45:40 +0100 Subject: [PATCH 06/12] remove ls --- webhook_application_dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index fd65d9b..a763a80 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -25,7 +25,6 @@ WORKDIR /opt/webhook RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook-linux-amd64.tar.gz -O artifact.tar.gz \ && tar --strip-components=1 -xvzf artifact.tar.gz \ - && ls -ls \ && rm artifact.tar.gz RUN echo "- id: whoami-webhook" > hooks.yaml \ -- 2.39.5 From 085f952a28eb39aecefb7e5b165c044e0be69ef0 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 10:41:16 +0100 Subject: [PATCH 07/12] update --- webhook_application_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index a763a80..585013f 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -34,4 +34,4 @@ EXPOSE 9000 USER webhook -ENTRYPOINT ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +ENTRYPOINT ['./opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 0b0fcd186f17d7ffa5a7f07e41a97be6008a176f Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 10:48:27 +0100 Subject: [PATCH 08/12] update --- webhook_application_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 585013f..8f4b887 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -34,4 +34,4 @@ EXPOSE 9000 USER webhook -ENTRYPOINT ['./opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +CMD ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 082610628a1a50e41aa3b9ad20fd23202d8ded8b Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 10:49:22 +0100 Subject: [PATCH 09/12] try --- webhook_application_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 8f4b887..87b093e 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -34,4 +34,4 @@ EXPOSE 9000 USER webhook -CMD ['/opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +CMD ['./opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 0f60603f3de7c91a6c9cae2cdc7f59bbbd37ca62 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 10:56:20 +0100 Subject: [PATCH 10/12] try directly --- webhook_application_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 87b093e..df494ff 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -34,4 +34,4 @@ EXPOSE 9000 USER webhook -CMD ['./opt/webhook/webhook', '-hooks', 'hooks.yaml', '-verbose' ] +CMD ['./webhook', '-hooks', 'hooks.yaml', '-verbose' ] -- 2.39.5 From 512e81d4b614c2379c949ae5cf74c27523b80446 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 10:58:27 +0100 Subject: [PATCH 11/12] cleanup --- webhook_application_dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index df494ff..5e22a3b 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -34,4 +34,4 @@ EXPOSE 9000 USER webhook -CMD ['./webhook', '-hooks', 'hooks.yaml', '-verbose' ] +CMD [ "./webhook", "-hooks", "hooks.yaml", "-verbose" ] -- 2.39.5 From c1d2592d7eda9e8fe9109071d62403dcb822b8d3 Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Thu, 19 Dec 2024 11:05:04 +0100 Subject: [PATCH 12/12] add healthcheck --- webhook_application_dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webhook_application_dockerfile b/webhook_application_dockerfile index 5e22a3b..e4d6b6a 100644 --- a/webhook_application_dockerfile +++ b/webhook_application_dockerfile @@ -30,8 +30,10 @@ RUN wget https://github.com/adnanh/webhook/releases/download/${VERSION}/webhook- RUN echo "- id: whoami-webhook" > hooks.yaml \ && echo " execute-command: 'whoami'" >> hooks.yaml -EXPOSE 9000 - USER webhook +EXPOSE 9000 + +HEALTHCHECK --timeout=4s CMD curl --silent --fail http://127.0.0.1:9000/ || exit 1 + CMD [ "./webhook", "-hooks", "hooks.yaml", "-verbose" ] -- 2.39.5