build.sh: Add BUILD_OPTS for custom build options
authorW. Trevor King <wking@tremily.us>
Thu, 13 Feb 2014 22:39:54 +0000 (14:39 -0800)
committerW. Trevor King <wking@tremily.us>
Thu, 13 Feb 2014 22:39:54 +0000 (14:39 -0800)
For example, to rebuild a package without using the cache:

  $ REPOS=docker-registry BUILD_OPTS=--no-cache ./build.sh

which lets you update your image after the upstream repository has
changed.

build.sh

index 148c30db867d6b451e4065a80b78148339cf875a..2926e7d75256e63bd61b39d00ca6b5172e2d694a 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -38,6 +38,7 @@ PORTAGE_SIG="${PORTAGE_SIG:-${PORTAGE}.gpgsig}"
 
 DOCKER_IO=$(command -v docker.io)
 DOCKER="${DOCKER:-${DOCKER_IO:-docker}}"
+BUILD_OPTS="${BUILD_OPTS:-}"
 
 REPOS="${REPOS:-
        portage
@@ -203,7 +204,7 @@ build_repo()
                                < "${REPO}/Dockerfile.template" > "${REPO}/Dockerfile"
 
                msg "build ${NAMESPACE}/${REPO}:${DATE}"
-               "${DOCKER}" build -t "${NAMESPACE}/${REPO}:${DATE}" "${REPO}" || die "failed to build"
+               "${DOCKER}" build ${BUILD_OPTS} -t "${NAMESPACE}/${REPO}:${DATE}" "${REPO}" || die "failed to build"
        fi
        msg "tag ${NAMESPACE}/${REPO}:latest"
        "${DOCKER}" tag -f "${NAMESPACE}/${REPO}:${DATE}" "${NAMESPACE}/${REPO}:latest" || die "failed to tag"