diff --git a/webhooks-git/Dockerfile b/webhooks-git/Dockerfile index 253391a..8865197 100644 --- a/webhooks-git/Dockerfile +++ b/webhooks-git/Dockerfile @@ -4,7 +4,7 @@ COPY hooks.json.example /etc/webhook/hooks.json FROM alpine:latest RUN apk --no-cache add git openssh-client bash nano COPY --from=build /usr/local/bin/webhook /usr/local/bin/webhook +COPY entrypoint.sh /etc/webhook/entrypoint.sh WORKDIR /etc/webhook EXPOSE 9000 -ENTRYPOINT ["/usr/local/bin/webhook"] -CMD ["-verbose", "-hooks=/etc/webhook/hooks.json", "-hotreload"] \ No newline at end of file +ENTRYPOINT ["/etc/webhook/entrypoint.sh"] \ No newline at end of file diff --git a/webhooks-git/entrypoint.sh b/webhooks-git/entrypoint.sh new file mode 100644 index 0000000..93acb32 --- /dev/null +++ b/webhooks-git/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# +# Create hosts.json with by replacing environment variables in template file +# + +# Define the template file path +template_file="/etc/webhook/hook.json.tmpl" + +# Define the output file path +output_file="/etc/webhook/hook.json" + +# Check if the template file exists +if [ ! -f "$template_file" ]; then + echo "Template file $template_file not found." + exit 1 +fi + +envsubst < "$template_file" > "$output_file" + +echo "Generated $output_file" + +# +# Start webhooks +# + +echo "Starting webhooks service" +exec /usr/local/bin/webhook -verbose -hooks=/etc/webhook/hooks.json -hotreload \ No newline at end of file