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
This commit is contained in:
Jean-Philippe Evrard 2018-09-12 23:52:53 +02:00
parent 2df96283b9
commit ba4d187092
4 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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