Skip to content

Commit

Permalink
add forever.sh script for handling SIGTERM with graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
gi8lino committed Oct 21, 2024
1 parent 35e4b99 commit 468a19f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,8 @@ RUN apk add --no-cache \
RUN wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64 && \
chmod +x /usr/local/bin/yq

RUN echo """
#!/bin/bash
_term() {
echo "Caught SIGTERM signal!"
kill -TERM 1 2>/dev/null
}
trap _term EXIT
sleep infinity
""" > /usr/bin/forever
COPY forever.sh /usr/bin/forever
RUN chmod +x /usr/bin/forever

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD [ "/usr/bin/forever" ]
Expand Down
10 changes: 10 additions & 0 deletions forever.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

_term() {
echo "Caught SIGTERM signal!"
kill -TERM 1 2>/dev/null
}

trap _term EXIT

sleep infinity

0 comments on commit 468a19f

Please sign in to comment.