d9208100 |
#!/bin/bash
|
e3bb13a1 |
# This script builds all images locally except the base and release images,
# which are handled by hack/build-base-images.sh. |
d9208100 |
|
ac49969c |
# NOTE: you only need to run this script if your code changes are part of
# any images OpenShift runs internally such as origin-sti-builder, origin-docker-builder,
# origin-deployer, etc.
|
d9208100 |
set -o errexit
set -o nounset
set -o pipefail
|
b52db8df |
STARTTIME=$(date +%s) |
e3bb13a1 |
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/common.sh" |
09a8c7d3 |
source "${OS_ROOT}/hack/util.sh" |
587623e3 |
source "${OS_ROOT}/contrib/node/install-sdn.sh" |
09a8c7d3 |
os::log::install_errexit |
d9208100 |
# Go to the top of the tree. |
e3bb13a1 |
cd "${OS_ROOT}"
# Get the latest Linux release
if [[ ! -d _output/local/releases ]]; then
echo "No release has been built. Run hack/build-release.sh"
exit 1
fi |
794be1e2 |
# Extract the release achives to a staging area. |
6fe74370 |
os::build::detect_local_release_tars "linux-64bit" |
794be1e2 |
|
776b67b2 |
echo "Building images from release tars for commit ${OS_RELEASE_COMMIT}:" |
95594479 |
echo " primary: $(basename ${OS_PRIMARY_RELEASE_TAR})"
echo " image: $(basename ${OS_IMAGE_RELEASE_TAR})" |
e3bb13a1 |
|
ef1d68cb |
imagedir="$(mktemp -d 2>/dev/null || mktemp -d -t imagedir.XXXXXX)" |
6fe74370 |
tar xzpf "${OS_PRIMARY_RELEASE_TAR}" --strip-components=1 -C "${imagedir}"
tar xzpf "${OS_IMAGE_RELEASE_TAR}" --strip-components=1 -C "${imagedir}" |
e3bb13a1 |
|
95594479 |
# Copy primary binaries to the appropriate locations. |
a926e202 |
cp -pf "${imagedir}/openshift" images/origin/bin
cp -pf "${imagedir}/openshift" images/router/haproxy/bin
cp -pf "${imagedir}/openshift" images/ipfailover/keepalived/bin |
e3bb13a1 |
|
794be1e2 |
# Copy image binaries to the appropriate locations. |
a926e202 |
cp -pf "${imagedir}/pod" images/pod/bin
cp -pf "${imagedir}/hello-openshift" examples/hello-openshift/bin
cp -pf "${imagedir}/deployment" examples/deployment/bin
cp -pf "${imagedir}/gitserver" examples/gitserver/bin
cp -pf "${imagedir}/dockerregistry" images/dockerregistry/bin |
ac8cee50 |
cp -pf "${imagedir}/recycle" images/recycler/bin |
28b61240 |
|
123b4fd9 |
# Copy SDN scripts into images/node |
56a0b72f |
os::provision::install-sdn "${OS_ROOT}" "${OS_ROOT}/images/node" |
123b4fd9 |
mkdir -p images/node/conf/
cp -pf "${OS_ROOT}/contrib/systemd/openshift-sdn-ovs.conf" images/node/conf/
|
776b67b2 |
# builds an image and tags it two ways - with latest, and with the release tag
function image {
echo "--- $1 ---"
docker build -t $1:latest $2 |
e99b8e36 |
docker tag -f $1:latest $1:${OS_RELEASE_COMMIT} |
776b67b2 |
} |
28b61240 |
|
123b4fd9 |
# images that depend on scratch / centos |
776b67b2 |
image openshift/origin-pod images/pod |
123b4fd9 |
image openshift/openvswitch images/openvswitch |
e3bb13a1 |
# images that depend on openshift/origin-base |
776b67b2 |
image openshift/origin images/origin
image openshift/origin-haproxy-router images/router/haproxy |
c3904e81 |
image openshift/origin-keepalived-ipfailover images/ipfailover/keepalived |
04bc45a0 |
image openshift/origin-docker-registry images/dockerregistry |
e3bb13a1 |
# images that depend on openshift/origin |
776b67b2 |
image openshift/origin-deployer images/deployer |
c5b047b7 |
image openshift/origin-recycler images/recycler |
776b67b2 |
image openshift/origin-docker-builder images/builder/docker/docker-builder |
bdf55d24 |
image openshift/origin-gitserver examples/gitserver |
776b67b2 |
image openshift/origin-sti-builder images/builder/docker/sti-builder |
f88e8dc5 |
image openshift/origin-f5-router images/router/f5 |
123b4fd9 |
image openshift/node images/node |
5d1a2515 |
# unpublished images |
776b67b2 |
image openshift/origin-custom-docker-builder images/builder/docker/custom-docker-builder
|
3f9b0d56 |
# extra images (not part of infrastructure)
image openshift/hello-openshift examples/hello-openshift
docker build --no-cache -t openshift/deployment-example:v1 examples/deployment
docker build --no-cache -t openshift/deployment-example:v2 -f examples/deployment/Dockerfile.v2 examples/deployment
|
776b67b2 |
echo "++ Active images" |
400c3669 |
docker images | grep openshift/ |
b52db8df |
ret=$?; ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"; exit "$ret" |