Browse Source

add tini to forward signals and to reap zombies

Fabian Peter Hammerle 3 years ago
parent
commit
b4742c6121
2 changed files with 5 additions and 2 deletions
  1. 3 1
      Dockerfile
  2. 2 1
      entrypoint.sh

+ 3 - 1
Dockerfile

@@ -20,6 +20,8 @@ RUN apt-get update \
     && if grep --extended-regex --invert-match '^[a-z0-9_-]+:[\*!]:' /etc/shadow; then exit 1; fi \
     && mkdir "$SSHD_HOST_KEYS_DIR" \
     && chown -c "$USER" "$SSHD_HOST_KEYS_DIR"
+# TODO merge up
+RUN apt-get update && apt-get install --yes tini
 VOLUME $GITOLITE_HOME_PATH
 VOLUME $SSHD_HOST_KEYS_DIR
 
@@ -28,7 +30,7 @@ EXPOSE 2200/tcp
 
 ENV GITOLITE_INITIAL_ADMIN_NAME=admin
 COPY entrypoint.sh /
-ENTRYPOINT ["/entrypoint.sh"]
+ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]
 
 USER $USER
 CMD ["/usr/sbin/sshd", "-D", "-e"]

+ 2 - 1
entrypoint.sh

@@ -20,7 +20,8 @@ printenv | cut -d = -f 1 | while IFS= read -r var_name; do
         user="$(echo "$var_name" | cut -d _ -f 5-)"
         key_path="$HOME/container-entrypoint-user-public-keys/${user}.pub"
         mkdir --parents "$(dirname "$key_path")"
-        (set -x; printenv "$var_name" > "$key_path"; gitolite setup --pubkey "$key_path")
+        printenv "$var_name" > "$key_path"
+        (set -x; gitolite setup --pubkey "$key_path")
     fi
 done