As the amount of docker images and corresponding docker_entrypoint.sh
files increases, I end up with repeated bash code across all entry point scripts. Since I hate repeated code my first thought was to create a shared lib folder with bash routines that are used by multiple entry point scripts.
However I'm not sure if this is a good practice mainly because we are leaving Docker's build context and we may get errors such as Forbidden path outside the build context
(e.g. see here). I realize that we may work around this type of problems by doing something like creating symbolic links to connect the build context to the lib folder, but I'm not sure if I like this type of approach.
Therefore my question is whether it is a good idea to have shared libs for Docker entry points at all and: i) if not, is there a better approach to avoid repeated code; ii) if so, what is the best way to avoid problems such as the above-mentioned ones.
Thank you all for your attention