Skip to content

Commit

Permalink
Using tini to fix the issue with bash not propagating SIGINT and SIGT…
Browse files Browse the repository at this point in the history
…ERM properly. Specifically, the -g switch to tini makes it send the signal to the whole process group and not only to the direct subprocess.
  • Loading branch information
freol35241 committed May 24, 2024
1 parent ee33c2d commit 45b2b32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.11-slim-bullseye

ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini

RUN apt-get update && apt-get install -y \
socat \
jq \
Expand All @@ -14,4 +17,4 @@ COPY bash-init.sh /bash-init.sh

ENV BASH_ENV=/bash-init.sh

ENTRYPOINT ["/bin/bash", "-l", "-c"]
ENTRYPOINT ["/tini", "-g", "--", "/bin/bash", "-c"]
11 changes: 11 additions & 0 deletions bash-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

set -euo pipefail

echoerr() { echo "$@" 1>&2; }

echoerr "Porla is starting up..."
echoerr "Executing: $BASH_EXECUTION_STRING"

exit() {
echoerr "Porla is shutting down..."
}

trap exit SIGINT SIGTERM

function to_bus () {
bus="$1"

Expand Down

0 comments on commit 45b2b32

Please sign in to comment.