Skip to content

Commit

Permalink
Allow context to be provided to hack/env itself
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Sep 16, 2016
1 parent 734a79b commit 67479ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1091,23 +1091,23 @@ function os::build::environment::create() {
set -o errexit
local release_image="${OS_BUILD_ENV_IMAGE}"
local additional_context="${OS_BUILD_ENV_DOCKER_ARGS:-}"
if [[ -z "${additional_context}" && "${OS_BUILD_ENV_USE_DOCKER:-y}" == "y" ]]; then
additional_context="--privileged -v /var/run/docker.sock:/var/run/docker.sock"
if [[ "${OS_BUILD_ENV_USE_DOCKER:-y}" == "y" ]]; then
additional_context+="--privileged -v /var/run/docker.sock:/var/run/docker.sock"

if [[ "${OS_BUILD_ENV_LOCAL_DOCKER:-n}" == "y" ]]; then
# if OS_BUILD_ENV_LOCAL_DOCKER==y, add the local OS_ROOT as the bind mount to the working dir
# and set the running user to the current user
local workingdir
workingdir=$( os::build::environment::release::workingdir )
additional_context="${additional_context} -v ${OS_ROOT}:${workingdir} -u $(id -u)"
additional_context+=" -v ${OS_ROOT}:${workingdir} -u $(id -u)"
elif [[ -n "${OS_BUILD_ENV_REUSE_VOLUME:-}" ]]; then
# if OS_BUILD_ENV_REUSE_VOLUME is set, create a docker volume to store the working output so
# successive iterations can reuse shared code.
local workingdir
workingdir=$( os::build::environment::release::workingdir )
name="$( echo "${OS_BUILD_ENV_REUSE_VOLUME}" | tr '[:upper:]' '[:lower:]' )"
docker volume create --name "${name}" > /dev/null
additional_context="${additional_context} -v ${name}:${workingdir}"
additional_context+=" -v ${name}:${workingdir}"
fi
fi

Expand Down

0 comments on commit 67479ff

Please sign in to comment.