containerfile: automatically search for distro docker files
This makes the container file element search the active element list for `containerfiles/${DIB_RELEASE}` for building. This makes it easy to write wrappers for ubuntu/fedora/etc. containerfile elements. Change-Id: I68f1d928e54a70bad76985ddd3e156bb5f978b0d
This commit is contained in:
parent
b536dbba8e
commit
2a14088eac
@ -5,5 +5,10 @@ containerfile
|
||||
Base element for creating images from container files (aka
|
||||
Dockerfiles).
|
||||
|
||||
To use this element, create a container file (Dockerfile), and supply
|
||||
the path to that file in the environment variable `DIB_CONTAINER_FILE`.
|
||||
Usually this element will be called via a more specific distro element
|
||||
which provides an environment for building a full image. This element
|
||||
will search active elements for a container file located in
|
||||
`containerfiles/${DIB_RELEASE}`.
|
||||
|
||||
Alternatively, to use this element directly supply the path to a
|
||||
container file in the environment variable `DIB_CONTAINER_FILE`.
|
||||
|
@ -25,7 +25,26 @@ if [ -f ${TARGET_ROOT}/.extra_settings ] ; then
|
||||
. ${TARGET_ROOT}/.extra_settings
|
||||
fi
|
||||
|
||||
[ -n "$DIB_CONTAINER_FILE" ]
|
||||
if [ -z "${DIB_CONTAINER_FILE:-}" ]; then
|
||||
_xtrace=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
eval declare -A image_elements=($(get_image_element_array))
|
||||
|
||||
for i in "${!image_elements[@]}"; do
|
||||
element=$i
|
||||
element_dir=${image_elements[$i]}
|
||||
|
||||
containerfile="${element_dir}/containerfiles/${DIB_RELEASE}"
|
||||
if [ -f "${containerfile}" ]; then
|
||||
echo "Found container file ${containerfile}"
|
||||
DIB_CONTAINER_FILE="${containerfile}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
$_xtrace
|
||||
fi
|
||||
|
||||
# Use the image cache directory as the default context, so anything
|
||||
# there is automatically available for COPY commands.
|
||||
|
Loading…
Reference in New Issue
Block a user