From 0a4cb6194e5e4268ce2173c414aacafda4b30af6 Mon Sep 17 00:00:00 2001 From: Erika Pauwels Date: Tue, 21 Oct 2025 10:20:30 +0200 Subject: [PATCH] Add support for on-build script to execute during Docker build In-line with on-build support of mu-javascript-template and mu-ruby-template --- Dockerfile | 8 +++++++- README.md | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a39ad58..e7c5f36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,13 @@ RUN ln -s /app /usr/src/app/ext \ && cd /usr/src/app \ && pip3 install -r requirements.txt -ONBUILD ADD Dockerfile requirement[s].txt /app/ +ONBUILD ADD Dockerfile requirement[s].txt on-build.sh* /app/ +ONBUILD RUN if [ -f /app/on-build.sh ]; \ + then \ + echo "Running custom on-build.sh of child" \ + && chmod +x /app/on-build.sh \ + && /bin/bash /app/on-build.sh ;\ + fi ONBUILD RUN cd /app/ \ && if [ -f requirements.txt ]; then pip install -r requirements.txt; fi diff --git a/README.md b/README.md index ce50a8f..6354cb8 100644 --- a/README.md +++ b/README.md @@ -347,3 +347,6 @@ python3 -m pip install pydoc-markdown python3 README.py ``` You can customise the output through the API configuration! See [README.py](README.py) && the [pydoc-markdown docs](https://niklasrosenstein.github.io/pydoc-markdown/). + +### Custom build commands +To execute custom bash statements during the image build (e.g. to install aditional system libraries), provide an `on-build.sh` script in the root of your service. It will be automatically picked up and executed by the Docker build.