Skip to content

Commit 6675128

Browse files
JuniorJPDJthresheek
authored andcommitted
Source entrypoint files with .envsh extension
This allows reusing variables declared between entrypoint scripts
1 parent 1dca42f commit 6675128

File tree

11 files changed

+99
-0
lines changed

11 files changed

+99
-0
lines changed

entrypoint/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

mainline/alpine-perl/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

mainline/alpine-slim/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

mainline/alpine/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

mainline/debian-perl/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

mainline/debian/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

stable/alpine-perl/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

stable/alpine-slim/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

stable/alpine/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

stable/debian-perl/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
1616
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
1717
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
1818
case "$f" in
19+
*.envsh)
20+
if [ -x "$f" ]; then
21+
echo >&3 "$0: Sourcing $f";
22+
source "$f"
23+
else
24+
# warn on shell scripts without exec bit
25+
echo >&3 "$0: Ignoring $f, not executable";
26+
fi
27+
;;
1928
*.sh)
2029
if [ -x "$f" ]; then
2130
echo >&3 "$0: Launching $f";

0 commit comments

Comments
 (0)