From ba4d187092e21faa67b88f5c84c9b3a20301df62 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Wed, 12 Sep 2018 23:52:53 +0200 Subject: [PATCH] Introduce extra *dep parameter Without this patch, it is not possible to have your own bindep or pydep file, and you must rely on what is in tree. This is a problem for deployers that want to bring their own bindep file, as they would need to fork the repository or 'taint it' by altering its content before building. This patch introduces new parameters, EXTRA_BINDEP and EXTRA_PYDEP, whose contents are path of files to be copied into the containers. These parameters will be chained (added on top of) the default *dep files. In the current status Docker doesn't allow multiple files to be passed as argument, and therefore the ability of overrides is limited, but should be enough to allow deployers to provide ONE file on top of existing bindep/pydeps. Change-Id: I7e9f7954bb3c31dd8fee87c253a8768c6ec52b5c --- Dockerfile | 4 +++- README.md | 4 ++++ scripts/install.sh | 6 ++++-- scripts/install_packages.sh | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 256046f..b151e4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ ARG PIP_ARGS="" ARG DIST_PACKAGES="" ARG PLUGIN=no ARG PYTHON3=no +ARG EXTRA_BINDEP="" +ARG EXTRA_PYDEP="" ARG UID=42424 ARG GID=42424 @@ -23,6 +25,6 @@ ARG SPICE_REPO=https://gitlab.freedesktop.org/spice/spice-html5.git ARG SPICE_REF=spice-html5-0.1.6 COPY scripts /opt/loci/scripts -COPY bindep.txt pydep.txt /opt/loci/ +ADD bindep.txt pydep.txt $EXTRA_BINDEP $EXTRA_PYDEP /opt/loci/ RUN /opt/loci/scripts/install.sh diff --git a/README.md b/README.md index 00466ac..4dc5d15 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,10 @@ For more advanced building you can use docker build arguments to define: * `PIP_ARGS` Specify additional pip's parameters you would like. * `DIST_PACKAGES` Specify additional distribution packages you would like installed. + * `EXTRA_BINDEP` Specify a bindep-* file to add in the container. It would + be considered next to the default bindep.txt. + * `EXTRA_PYDEP` Specify a pydep-* file to add in the container. It would + be considered next to the default pydep.txt. This makes it really easy to integrate LOCI images into your development or CI/CD workflow, for example, if you wanted to build an image from [this diff --git a/scripts/install.sh b/scripts/install.sh index ee0591e..eee1fc3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -78,8 +78,10 @@ if [[ "${PLUGIN}" == "no" ]]; then $(dirname $0)/create_user.sh $(dirname $0)/setup_pip.sh $(dirname $0)/pip_install.sh bindep - PACKAGES=($(bindep -f /opt/loci/pydep.txt -b -l newline ${PROJECT} ${PROFILES} ${python3} || :)) - $(dirname $0)/pip_install.sh ${PACKAGES[@]} + for file in /opt/loci/pydep*; do + PYDEP_PACKAGES+=($(bindep -f $file -b -l newline ${PROJECT} ${PROFILES} ${python3} || :)) + done + $(dirname $0)/pip_install.sh ${PYDEP_PACKAGES[@]} fi if [[ ${PROJECT} == 'nova' ]]; then diff --git a/scripts/install_packages.sh b/scripts/install_packages.sh index fba3f5d..1ff0282 100755 --- a/scripts/install_packages.sh +++ b/scripts/install_packages.sh @@ -6,7 +6,9 @@ if [[ "${PYTHON3}" != "no" ]]; then python3=python3 fi -PACKAGES=($(bindep -f /opt/loci/bindep.txt -b -l newline ${PROJECT} ${PROFILES} ${python3} || :)) +for file in /opt/loci/bindep*; do + PACKAGES+=($(bindep -f $file -b -l newline ${PROJECT} ${PROFILES} ${python3} || :)) +done if [[ ! -z ${PACKAGES} ]]; then case ${distro} in