From f26665c31dddd92406ef3f04ff8a3ca14ae606a9 Mon Sep 17 00:00:00 2001 From: istmxrein <maximilian.reinheimer@stud.h-da.de> Date: Fri, 9 Sep 2022 12:41:24 +0200 Subject: [PATCH] add proper signal handling on sigterm --- Containerfile | 5 +++-- start.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Containerfile b/Containerfile index 5ffbe8a..fa266a2 100644 --- a/Containerfile +++ b/Containerfile @@ -35,11 +35,11 @@ LABEL maintainer="Dmitry Misharov <misharov@redhat.com>" \ WORKDIR $HOME -COPY cleanup.py env.py config.sh prepare.py run.py requirements.txt start.sh . +COPY cleanup.py env.py config.sh prepare.py run.py requirements.txt start.sh ./ RUN dnf install -y --nodocs python38-pip git-core && \ python3.8 -m venv $VENV && \ - pip install wheel && \ + pip install wheel dumb-init && \ pip install -r requirements.txt && \ dnf remove -y git-core && \ dnf clean all -y @@ -50,4 +50,5 @@ RUN chgrp -R 0 $HOME && \ USER 1001 +ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["./start.sh"] diff --git a/start.sh b/start.sh index d840fb0..4cce533 100644 --- a/start.sh +++ b/start.sh @@ -1,6 +1,6 @@ #!/bin/bash -trap cleanup 1 2 3 6 +trap cleanup SIGTERM cleanup() { gitlab-runner unregister --all-runners -- GitLab