Last active
September 12, 2025 01:08
-
-
Save jimanx2/d6db95e592c31b94f94e4303b0cf2987 to your computer and use it in GitHub Desktop.
(b)ash script to automatically run extra scripts before the actual docker entrypoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # depends on env first, if none, | |
| # fall back to /etc/docker-entrypoint/init.d | |
| ENTRYPOINTS_D=${ENTRYPOINTS_D:-/etc/docker-entrypoint/init.d} | |
| # ensure entrypoints dir exists | |
| mkdir -p /etc/docker-entrypoint/init.d | |
| # load all .sh files according to glob sequence | |
| for initscript in $(find $ENTRYPOINTS_D -maxdepth 1 -type f -name "*.sh" | sort); do | |
| sh $initscript > /dev/stdout 2>/dev/stderr | |
| done | |
| # once done, exec the actual intended script | |
| exec $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment