aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin André <martin.andre@kvhasia.com>2015-02-26 15:00:42 +0900
committerMartin André <martin.andre@kvhasia.com>2015-03-02 14:08:06 +0900
commit0764fd7dea3f56627bb42e285cfb818cce08229e (patch)
treeb31933605cef228bca79737cbefc94b79c5e2e8f /tools
parent5052e54f45998110ec10239bb715ff80d51042ab (diff)
downloadkolla-0764fd7dea3f56627bb42e285cfb818cce08229e.tar.gz
kolla-0764fd7dea3f56627bb42e285cfb818cce08229e.zip
Allow changing base image
By changing the PREFIX variable in the .buildconf one is now able to build docker images from different bases. For example, add the following line to your .buildconf file to build CentOS based images: PREFIX=centos-rdo- Default base image is Fedora. For now only RH family is supported. Additionally, changing the namespace either with the NAMESPACE variable in .buildconf or via --namespace commandline option now changes the source namespace as well from the default kollaglue one. Implements: blueprint multi-baseos Co-Authored-By: Steven Dake <stdake@cisco.com> Change-Id: I3964cd2292789ea883a1f2d2738a5731a4fff49b
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build-all-docker-images2
-rwxr-xr-xtools/build-docker-image4
2 files changed, 6 insertions, 0 deletions
diff --git a/tools/build-all-docker-images b/tools/build-all-docker-images
index 2780d50e8..d49d0ac92 100755
--- a/tools/build-all-docker-images
+++ b/tools/build-all-docker-images
@@ -70,6 +70,8 @@ function init_image {
local image="${NAMESPACE:+${NAMESPACE}/}${PREFIX}${img_dir##*/}"
local base_image=$(cat $img_dir/Dockerfile | gawk 'match($0, /^\s*FROM\s+(\S+)/, matches) {print matches[1]}' )
+ base_image=${base_image//%%KOLLA_NAMESPACE%%/$NAMESPACE}
+ base_image=${base_image//%%KOLLA_PREFIX%%/$PREFIX}
img_dirs[$image]=$img_dir
dependency[$image]=$base_image
diff --git a/tools/build-docker-image b/tools/build-docker-image
index 82d210d0c..fae5cab98 100755
--- a/tools/build-docker-image
+++ b/tools/build-docker-image
@@ -90,6 +90,10 @@ fi
TMPDIR=$(mktemp -d /tmp/output.XXXXXXXXXX)
cp -aL $IMGDIR/* $TMPDIR
+# Use an extension for in-place editing for portability, as GNU and BSD
+# versions of sed behave differently otherwise
+sed -i.bak "s/%%KOLLA_NAMESPACE%%/${NAMESPACE}/g" $TMPDIR/Dockerfile
+sed -i.bak "s/%%KOLLA_PREFIX%%/${PREFIX}/g" $TMPDIR/Dockerfile
if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then
echo "ERROR: failed to build $FULLIMAGE"