dind: make supervisor image configurable

This commit is contained in:
Kostas Lekkas 2016-07-06 11:47:25 +03:00
parent 6aba97dce0
commit 1aca595eb2
2 changed files with 16 additions and 13 deletions

View File

@ -90,6 +90,12 @@ stop-supervisor:
-docker stop resin_supervisor_1 > /dev/null || true
-docker rm -f --volumes resin_supervisor_1 > /dev/null || true
refresh-supervisor:
echo " * Compiling CoffeeScript.." \
&& coffee -c ./src \
&& echo " * Restarting supervisor container.." \
&& docker exec -ti resin_supervisor_1 docker restart resin_supervisor
supervisor: gosuper
cp Dockerfile.$(DOCKERFILE) Dockerfile
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile

View File

@ -8,7 +8,7 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SUPERVISOR_BASE_DIR="${DIR}/../.."
ARCH=${ARCH:-"amd64"}
DEPLOY_REGISTRY=${DEPLOY_REGISTRY:-"registry.resindev.io/"}
SUPERVISOR_IMAGE=${SUPERVISOR_IMAGE:-"registry.resindev.io/resin/${ARCH}-supervisor:master"}
PASSWORDLESS_DROPBEAR=${PASSWORDLESS_DROPBEAR:-"false"}
SUPERVISOR_EXTRA_MOUNTS=
@ -18,20 +18,20 @@ function showHelp {
echo " faster development iterations by bind-mounting the local './src' directly into the running"
echo " supervisor container."
echo
echo " Setting the '--mount-nm' flag in either 'bindrun' or 'deploybindrun' action will bind-mount"
echo " './node_modules/' into the running supervisor as well. In this case, it's up to the developer"
echo " Setting the '--mount-nm' flag in either 'run' or 'deployrun' action will bind-mount"
echo " './node_modules/' into the running supervisor. In this case, it's up to the developer"
echo " to make sure that the correct dependencies are installed."
echo
echo " Usage: [environment] $0 action [options]"
echo
echo " Environment Variables:"
echo " ARCH [=amd64]"
echo " DEPLOY_REGISTRY [=registry.resindev.io/]"
echo " SUPERVISOR_IMAGE [=registry.resindev.io/resin/<ARCH>-supervisor:master]"
echo " PASSWORDLESS_DROPBEAR [=false]"
echo " Actions:"
echo " deploy build supervisor image and deploy it to the registry"
echo " run [options] build dind supervisor host container, run it, then pull supervisor container and run it as well"
echo " deployrun [options] run 'deploy' and 'run'"
echo " deploy build and deploy local supervisor image - you can override registry/image name with 'SUPERVISOR_IMAGE'"
echo " run [options] build dind supervisor host container, run it, then pull the configured 'SUPERVISOR_IMAGE' and run it"
echo " deployrun [options] run 'deploy' and then immediately 'run' the deployed container"
echo " refresh recompile sources in './src' with 'coffee -c' and restart supervisor container on dind host"
echo " stop stop dind supervisor host container"
echo " Options:"
@ -43,7 +43,7 @@ function showHelp {
function deploySupervisor {
make -C "$SUPERVISOR_BASE_DIR" \
ARCH="$ARCH" \
DEPLOY_REGISTRY="$DEPLOY_REGISTRY" \
SUPERVISOR_IMAGE="$SUPERVISOR_IMAGE" \
PASSWORDLESS_DROPBEAR="$PASSWORDLESS_DROPBEAR" \
deploy
}
@ -68,9 +68,9 @@ function runDind {
make -C "$SUPERVISOR_BASE_DIR" \
ARCH="$ARCH" \
SUPERVISOR_IMAGE="$SUPERVISOR_IMAGE" \
PASSWORDLESS_DROPBEAR="$PASSWORDLESS_DROPBEAR" \
SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \
SUPERVISOR_IMAGE="${DEPLOY_REGISTRY}resin/${ARCH}-supervisor:master" \
run-supervisor
}
@ -87,10 +87,7 @@ case $1 in
deploySupervisor && runDind "$@"
;;
refresh)
echo " * Compiling CoffeeScript.." \
&& coffee -c "$SUPERVISOR_BASE_DIR/src" \
&& echo " * Restarting supervisor container.." \
&& docker exec -ti resin_supervisor_1 docker restart resin_supervisor
make -C "$SUPERVISOR_BASE_DIR" refresh-supervisor
;;
stop)
make -C "$SUPERVISOR_BASE_DIR" stop-supervisor