diff options
47 files changed, 199 insertions, 136 deletions
diff --git a/docker/build b/docker/build deleted file mode 100755 index 7c9268870..000000000 --- a/docker/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# If the directories were numbered, a simple find could be used to build ;-) -push= - -CONTAINERS=(fedora-rdo-base cinder glance/glance-base glance/glance-api glance/glance-registry heat/heat-base heat/heat-api heat/heat-engine keystone mariadb rabbitmq swift/swift-base swift/swift-account swift/swift-container swift/swift-object swift/swift-proxy-server nova-compute/nova-base nova-compute/nova-compute nova-compute/nova-libvirt) - - -while getopts "hp" opt > /dev/null 2>&1; do - case $opt in - p) - push=yes - ;; - h) - cat <<EOF -$0 script will build all kolla docker images optionally if you specify the -p -option and you have access to the kubeglue docker namespace you will be able to -push the image in docker registry. -EOF - exit 0 - ;; - esac -done - -for IMAGE in ${CONTAINERS[@]}; do - pushd . - cd ${IMAGE} - echo "Building $IMAGE" - ./build - if [[ ${push} == yes ]] ;then - echo "Pushing $IMAGE" - ./push - fi - popd -done diff --git a/docker/cinder/build b/docker/cinder/build index 66081e4e0..d2accf7d3 100755..120000 --- a/docker/cinder/build +++ b/docker/cinder/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-cinder . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/cinder/push b/docker/cinder/push deleted file mode 100755 index 58795abb0..000000000 --- a/docker/cinder/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-cinder . diff --git a/docker/fedora-rdo-base/build b/docker/fedora-rdo-base/build index 8e5867b88..d2accf7d3 100755..120000 --- a/docker/fedora-rdo-base/build +++ b/docker/fedora-rdo-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-base . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/fedora-rdo-base/push b/docker/fedora-rdo-base/push deleted file mode 100755 index ed6c6029b..000000000 --- a/docker/fedora-rdo-base/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-base . diff --git a/docker/glance/build b/docker/glance/build deleted file mode 100755 index 7f0534c18..000000000 --- a/docker/glance/build +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -for image in glance-base glance-api glance-registry; do -( - pushd $image - ./build - popd -) -done - diff --git a/docker/glance/glance-api/build b/docker/glance/glance-api/build index 88434b114..43944faa0 100755..120000 --- a/docker/glance/glance-api/build +++ b/docker/glance/glance-api/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-glance-api . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/glance/glance-api/push b/docker/glance/glance-api/push deleted file mode 100755 index 6c1edacbe..000000000 --- a/docker/glance/glance-api/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-glance-api . diff --git a/docker/glance/glance-base/build b/docker/glance/glance-base/build index 75a42b8a0..43944faa0 100755..120000 --- a/docker/glance/glance-base/build +++ b/docker/glance/glance-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-glance-base . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/glance/glance-base/push b/docker/glance/glance-base/push deleted file mode 100755 index 3de87a26c..000000000 --- a/docker/glance/glance-base/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-glance-base . diff --git a/docker/glance/glance-registry/build b/docker/glance/glance-registry/build index 47e88f5ef..43944faa0 100755..120000 --- a/docker/glance/glance-registry/build +++ b/docker/glance/glance-registry/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-glance-registry . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/glance/glance-registry/push b/docker/glance/glance-registry/push deleted file mode 100755 index f69cca5a1..000000000 --- a/docker/glance/glance-registry/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-glance-registry . diff --git a/docker/glance/push b/docker/glance/push deleted file mode 100755 index daadc4937..000000000 --- a/docker/glance/push +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -for image in glance-base glance-api glance-registry; do -( - pushd $image - ./push - popd -) -done - diff --git a/docker/heat/heat-api/build b/docker/heat/heat-api/build index 16a5acc1d..43944faa0 100755..120000 --- a/docker/heat/heat-api/build +++ b/docker/heat/heat-api/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-heat-api . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/heat/heat-api/push b/docker/heat/heat-api/push deleted file mode 100755 index 3ab396aee..000000000 --- a/docker/heat/heat-api/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-heat-api . diff --git a/docker/heat/heat-base/build b/docker/heat/heat-base/build index e20076c89..43944faa0 100755..120000 --- a/docker/heat/heat-base/build +++ b/docker/heat/heat-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-heat-base . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/heat/heat-base/push b/docker/heat/heat-base/push deleted file mode 100755 index ef525ec87..000000000 --- a/docker/heat/heat-base/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-heat-base . diff --git a/docker/heat/heat-engine/build b/docker/heat/heat-engine/build index 1a2f7ccbb..43944faa0 100755..120000 --- a/docker/heat/heat-engine/build +++ b/docker/heat/heat-engine/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-heat-engine . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/heat/heat-engine/push b/docker/heat/heat-engine/push deleted file mode 100755 index 9948eb100..000000000 --- a/docker/heat/heat-engine/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-heat-engine . diff --git a/docker/keystone/build b/docker/keystone/build index a1b40c837..d2accf7d3 100755..120000 --- a/docker/keystone/build +++ b/docker/keystone/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-keystone . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/keystone/push b/docker/keystone/push deleted file mode 100755 index 5e7bc88cb..000000000 --- a/docker/keystone/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-keystone . diff --git a/docker/mariadb/build b/docker/mariadb/build index ef2c05ddc..d2accf7d3 100755..120000 --- a/docker/mariadb/build +++ b/docker/mariadb/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-mariadb . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/mariadb/push b/docker/mariadb/push deleted file mode 100755 index da6da778d..000000000 --- a/docker/mariadb/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-mariadb . diff --git a/docker/nova-compute/build b/docker/nova-compute/build deleted file mode 100755 index 2c0ff1588..000000000 --- a/docker/nova-compute/build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-nova-compute . diff --git a/docker/nova-compute/nova-base/build b/docker/nova-compute/nova-base/build index 266c59185..43944faa0 100755..120000 --- a/docker/nova-compute/nova-base/build +++ b/docker/nova-compute/nova-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-nova-base . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/nova-compute/nova-base/push b/docker/nova-compute/nova-base/push deleted file mode 100755 index ea92f760c..000000000 --- a/docker/nova-compute/nova-base/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-nova-base . diff --git a/docker/nova-compute/nova-compute/build b/docker/nova-compute/nova-compute/build index 2c0ff1588..43944faa0 100755..120000 --- a/docker/nova-compute/nova-compute/build +++ b/docker/nova-compute/nova-compute/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-nova-compute . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/nova-compute/nova-compute/push b/docker/nova-compute/nova-compute/push deleted file mode 100755 index 5fe18cb3b..000000000 --- a/docker/nova-compute/nova-compute/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-nova-compute . diff --git a/docker/nova-compute/nova-libvirt/build b/docker/nova-compute/nova-libvirt/build index ec01bd27d..43944faa0 100755..120000 --- a/docker/nova-compute/nova-libvirt/build +++ b/docker/nova-compute/nova-libvirt/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-nova-libvirt . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/nova-compute/nova-libvirt/push b/docker/nova-compute/nova-libvirt/push deleted file mode 100755 index 604e44afd..000000000 --- a/docker/nova-compute/nova-libvirt/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-nova-libvirt . diff --git a/docker/nova-compute/push b/docker/nova-compute/push deleted file mode 100755 index 5fe18cb3b..000000000 --- a/docker/nova-compute/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-nova-compute . diff --git a/docker/rabbitmq/build b/docker/rabbitmq/build index 295844249..d2accf7d3 100755..120000 --- a/docker/rabbitmq/build +++ b/docker/rabbitmq/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-rabbitmq . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/rabbitmq/push b/docker/rabbitmq/push deleted file mode 100755 index f4dcc1fce..000000000 --- a/docker/rabbitmq/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-rabbitmq . diff --git a/docker/rhel-osp-base/build b/docker/rhel-osp-base/build index cec1d2af1..d2accf7d3 100755..120000 --- a/docker/rhel-osp-base/build +++ b/docker/rhel-osp-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag rhel-osp-base . +../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-account/build b/docker/swift/swift-account/build index 9db06bce9..43944faa0 100755..120000 --- a/docker/swift/swift-account/build +++ b/docker/swift/swift-account/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-swift-account-server . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-account/push b/docker/swift/swift-account/push deleted file mode 100755 index e0aad88b9..000000000 --- a/docker/swift/swift-account/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-swift-account . diff --git a/docker/swift/swift-base/build b/docker/swift/swift-base/build index b6dd0369b..43944faa0 100755..120000 --- a/docker/swift/swift-base/build +++ b/docker/swift/swift-base/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-swift-base . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-base/push b/docker/swift/swift-base/push deleted file mode 100755 index 2f0213c4d..000000000 --- a/docker/swift/swift-base/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-swift-base . diff --git a/docker/swift/swift-container/build b/docker/swift/swift-container/build index 949f7ac4c..43944faa0 100755..120000 --- a/docker/swift/swift-container/build +++ b/docker/swift/swift-container/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-swift-container-server . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-container/push b/docker/swift/swift-container/push deleted file mode 100755 index a805879a3..000000000 --- a/docker/swift/swift-container/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-swift-container . diff --git a/docker/swift/swift-object/build b/docker/swift/swift-object/build index eee05d6a9..43944faa0 100755..120000 --- a/docker/swift/swift-object/build +++ b/docker/swift/swift-object/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-swift-object-server . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-object/push b/docker/swift/swift-object/push deleted file mode 100755 index 7f05b6379..000000000 --- a/docker/swift/swift-object/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-swift-object . diff --git a/docker/swift/swift-proxy-server/build b/docker/swift/swift-proxy-server/build index 87de199be..43944faa0 100755..120000 --- a/docker/swift/swift-proxy-server/build +++ b/docker/swift/swift-proxy-server/build @@ -1,2 +1 @@ -#!/bin/bash -docker build --tag kollaglue/fedora-rdo-swift-proxy-server . +../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/swift/swift-proxy-server/push b/docker/swift/swift-proxy-server/push deleted file mode 100755 index 60208c931..000000000 --- a/docker/swift/swift-proxy-server/push +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker push kollaglue/fedora-rdo-swift-proxy . diff --git a/docs/image-building.md b/docs/image-building.md new file mode 100644 index 000000000..e3deef781 --- /dev/null +++ b/docs/image-building.md @@ -0,0 +1,75 @@ +# Image building + +The `tools/build-docker-image` script in this repository is +responsible for building docker images. It is symlinked as `./build` +inside each Docker image directory. + +When creating new image directories, you can run the +`tools/update-build-links` scripts to install the `build` symlink +(this script will install the symlink anywhere it find a file named +`Dockerfile`). + +## Workflow + +In general, you will build images like this: + + $ cd docker/keystone + $ ./build + +By default, the above command would build +`kollaglue/fedora-rdo-keystone:CID`, where `CID` is the current short +commit ID. That is, given: + + $ git rev-parse HEAD + 76a16029006a2f5d3b79f1198d81acb6653110e9 + +The above command would generate +`kollaglue/fedora-rdo-keystone:76a1602`. This tagging is meant to +prevent developers from stepping on each other or on release images +during the development process. + +To push the image after building, add `--push`: + + $ ./build --push + +To use these images, you must specify the tag in your `docker run` +commands: + + $ docker run kollaglue/fedora-rdo-keystone:76a1602 + +Or in your kubernetes configurations: + + "containers": [{ + "name": "keystone", + "image": "kollaglue/fedora-rdo-keystone:76a1602", + "ports": [ + {"containerPort": 5000}, + {"containerPort": 35357} + ], + "env": [ + {"name": "DB_ROOT_PASSWORD", "value": "password"}, + {"name": "KEYSTONE_ADMIN_TOKEN", "value": "ADMINTOKEN"} + ] + }] + +## Building releases + +To build into the `latest` tag, add `--release`: + + $ ./build --release + +Or to build and push: + + $ ./build --push --release + +## Configuration + +The `build-docker-image` script will look for a file named `.buildconf` +in your current directory and in the top level of the repository. You +can use this to set defaults, such as: + + NAMESPACE=larsks + +This setting would cause all images to be tagged into the `larsks/` +namespace. + diff --git a/tools/build-docker-image b/tools/build-docker-image new file mode 100755 index 000000000..66e534fa4 --- /dev/null +++ b/tools/build-docker-image @@ -0,0 +1,94 @@ +#!/bin/bash + +NAMESPACE=kollaglue +PREFIX=fedora-rdo- +TAG=$(git rev-parse --short HEAD) +IMAGE="${PREFIX}${PWD##*/}" + +TOPDIR=$(git rev-parse --show-toplevel) + +usage () { + cat <<EOF +$0: usage: $0 [options] + +Options: + +--namespace, -n <namespace> +--tag, -t <tag> +--push, -p +--no-cache, -N +--release +EOF +} + +[ -f ./.buildconf ] && . ./.buildconf +[ -f $TOPDIR/.buildconf ] && . $TOPDIR/.buildconf + +ARGS=$(getopt -o 'n:t:pN' -l help,namespace:,push,release,tag:,no-cache -- "$@") || { usage >&2; exit 2; } + +eval set -- "$ARGS" + +while :; do + case "$1" in + + (--help) usage + exit 0 + ;; + + (--release) MODE=release + TAG=latest + ;; + + (--tag|-t) shift + TAG="$1" + ;; + + (--push|-p) PUSH=1 + ;; + + (--no-cache|-N) + BUILDFLAGS="${BUILDFLAGS} --no-cache" + ;; + + (--namespace|-n) + shift + NAMESPACE="1" + ;; + + (--) break + ;; + + esac + + shift +done + +FULLIMAGE="${NAMESPACE}/${IMAGE}${TAG:+:${TAG}}" + +cat <<EOF +====================================================================== +$FULLIMAGE +====================================================================== + +EOF + +if [ "$MODE" = "release" ]; then + echo "*** YOU ARE BUILDING A RELEASE IMAGE ***" + echo +fi + +if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" .; then + echo "ERROR: failed to build $FULLIMAGE" + exit 1 +fi + +echo "Built: $FULLIMAGE" + +if [ "$PUSH" = 1 ]; then + if ! docker push "$FULLIMAGE"; then + echo "ERROR: failed to push $FULLIMAGE" + exit 1 + fi + + echo "Pushed: $FULLIMAGE" +fi diff --git a/tools/update-build-links b/tools/update-build-links new file mode 100755 index 000000000..ac6fa53a8 --- /dev/null +++ b/tools/update-build-links @@ -0,0 +1,10 @@ +#!/bin/sh + +cd $(git rev-parse --show-toplevel) +find docker -name Dockerfile | while read dockerfile; do + dir=${dockerfile%/*} + link=$(python -c 'import os,sys; print os.path.relpath(sys.argv[1], sys.argv[2])' \ + $PWD/tools/build-docker-image $dir) + ln -sf $link $dir/build +done + |
