Skip to content

Commit

Permalink
Revert "Merge branch 'kaluzki-issue-226-trap-sigterm'"
Browse files Browse the repository at this point in the history
This reverts commit 07d454f, reversing
changes made to 9ef62f0.
  • Loading branch information
htuscher committed Apr 18, 2020
1 parent 5842da3 commit 9e7b88a
Show file tree
Hide file tree
Showing 132 changed files with 1,334 additions and 1,334 deletions.
22 changes: 14 additions & 8 deletions docker/base/alpine/conf/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ function deprecationNotice() {
# Run "entrypoint" scripts
##
function runEntrypoints() {
# try to find entrypoint task script
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"
if [ ! -f "$TASK_SCRIPT" ]; then
# run default
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/default.sh"
###############
# Try to find entrypoint
###############

ENTRYPOINT_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"

if [ -f "$ENTRYPOINT_SCRIPT" ]; then
. "$ENTRYPOINT_SCRIPT"
fi

if [ ! -f "$TASK_SCRIPT" ]; then
exit 1
###############
# Run default
###############
if [ -f "/opt/docker/bin/entrypoint.d/default.sh" ]; then
. /opt/docker/bin/entrypoint.d/default.sh
fi

. "$TASK_SCRIPT"
exit 1
}

# Run "entrypoint" provisioning
Expand Down
45 changes: 0 additions & 45 deletions docker/base/alpine/conf/bin/entrypoint.d/run.sh

This file was deleted.

45 changes: 44 additions & 1 deletion docker/base/alpine/conf/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
#!/usr/bin/env bash

exec /opt/docker/bin/entrypoint.d/run.sh "$@"
if [[ -z "$CONTAINER_UID" ]]; then
export CONTAINER_UID="application"
fi

set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value

# auto elevate privileges (if container is not started as root)
if [[ "$UID" -ne 0 ]]; then
export CONTAINER_UID="$UID"
exec gosu root "$0" "$@"
fi
# remove suid bit on gosu
chmod -s /sbin/gosu

trap 'echo sigterm ; exit' SIGTERM
trap 'echo sigkill ; exit' SIGKILL

# sanitize input and set task
TASK="$(echo $1| sed 's/[^-_a-zA-Z0-9]*//g')"

source /opt/docker/bin/config.sh

createDockerStdoutStderr

if [[ "$UID" -eq 0 ]]; then
# Only run provision if user is root

if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
# Visible provisioning
runProvisionEntrypoint
else
# Hidden provisioning
runProvisionEntrypoint > /dev/null
fi
fi

#############################
## COMMAND
#############################

runEntrypoints "$@"
Empty file.
2 changes: 0 additions & 2 deletions docker/base/alpine/conf/provision/entrypoint.d/05-gosu.sh

This file was deleted.

This file was deleted.

22 changes: 14 additions & 8 deletions docker/base/centos-7/conf/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ function deprecationNotice() {
# Run "entrypoint" scripts
##
function runEntrypoints() {
# try to find entrypoint task script
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"
if [ ! -f "$TASK_SCRIPT" ]; then
# run default
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/default.sh"
###############
# Try to find entrypoint
###############

ENTRYPOINT_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"

if [ -f "$ENTRYPOINT_SCRIPT" ]; then
. "$ENTRYPOINT_SCRIPT"
fi

if [ ! -f "$TASK_SCRIPT" ]; then
exit 1
###############
# Run default
###############
if [ -f "/opt/docker/bin/entrypoint.d/default.sh" ]; then
. /opt/docker/bin/entrypoint.d/default.sh
fi

. "$TASK_SCRIPT"
exit 1
}

# Run "entrypoint" provisioning
Expand Down
45 changes: 0 additions & 45 deletions docker/base/centos-7/conf/bin/entrypoint.d/run.sh

This file was deleted.

45 changes: 44 additions & 1 deletion docker/base/centos-7/conf/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
#!/usr/bin/env bash

exec /opt/docker/bin/entrypoint.d/run.sh "$@"
if [[ -z "$CONTAINER_UID" ]]; then
export CONTAINER_UID="application"
fi

set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value

# auto elevate privileges (if container is not started as root)
if [[ "$UID" -ne 0 ]]; then
export CONTAINER_UID="$UID"
exec gosu root "$0" "$@"
fi
# remove suid bit on gosu
chmod -s /sbin/gosu

trap 'echo sigterm ; exit' SIGTERM
trap 'echo sigkill ; exit' SIGKILL

# sanitize input and set task
TASK="$(echo $1| sed 's/[^-_a-zA-Z0-9]*//g')"

source /opt/docker/bin/config.sh

createDockerStdoutStderr

if [[ "$UID" -eq 0 ]]; then
# Only run provision if user is root

if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
# Visible provisioning
runProvisionEntrypoint
else
# Hidden provisioning
runProvisionEntrypoint > /dev/null
fi
fi

#############################
## COMMAND
#############################

runEntrypoints "$@"
Empty file.
2 changes: 0 additions & 2 deletions docker/base/centos-7/conf/provision/entrypoint.d/05-gosu.sh

This file was deleted.

This file was deleted.

22 changes: 14 additions & 8 deletions docker/base/debian-10/conf/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ function deprecationNotice() {
# Run "entrypoint" scripts
##
function runEntrypoints() {
# try to find entrypoint task script
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"
if [ ! -f "$TASK_SCRIPT" ]; then
# run default
TASK_SCRIPT="/opt/docker/bin/entrypoint.d/default.sh"
###############
# Try to find entrypoint
###############

ENTRYPOINT_SCRIPT="/opt/docker/bin/entrypoint.d/${TASK}.sh"

if [ -f "$ENTRYPOINT_SCRIPT" ]; then
. "$ENTRYPOINT_SCRIPT"
fi

if [ ! -f "$TASK_SCRIPT" ]; then
exit 1
###############
# Run default
###############
if [ -f "/opt/docker/bin/entrypoint.d/default.sh" ]; then
. /opt/docker/bin/entrypoint.d/default.sh
fi

. "$TASK_SCRIPT"
exit 1
}

# Run "entrypoint" provisioning
Expand Down
45 changes: 0 additions & 45 deletions docker/base/debian-10/conf/bin/entrypoint.d/run.sh

This file was deleted.

45 changes: 44 additions & 1 deletion docker/base/debian-10/conf/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
#!/usr/bin/env bash

exec /opt/docker/bin/entrypoint.d/run.sh "$@"
if [[ -z "$CONTAINER_UID" ]]; then
export CONTAINER_UID="application"
fi

set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value

# auto elevate privileges (if container is not started as root)
if [[ "$UID" -ne 0 ]]; then
export CONTAINER_UID="$UID"
exec gosu root "$0" "$@"
fi
# remove suid bit on gosu
chmod -s /sbin/gosu

trap 'echo sigterm ; exit' SIGTERM
trap 'echo sigkill ; exit' SIGKILL

# sanitize input and set task
TASK="$(echo $1| sed 's/[^-_a-zA-Z0-9]*//g')"

source /opt/docker/bin/config.sh

createDockerStdoutStderr

if [[ "$UID" -eq 0 ]]; then
# Only run provision if user is root

if [ "$TASK" == "supervisord" -o "$TASK" == "noop" ]; then
# Visible provisioning
runProvisionEntrypoint
else
# Hidden provisioning
runProvisionEntrypoint > /dev/null
fi
fi

#############################
## COMMAND
#############################

runEntrypoints "$@"
Empty file.
2 changes: 0 additions & 2 deletions docker/base/debian-10/conf/provision/entrypoint.d/05-gosu.sh

This file was deleted.

This file was deleted.

0 comments on commit 9e7b88a

Please sign in to comment.