diff --git a/Makefile b/Makefile index 1e3d9ebf..7cda3ac1 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ # * SUPERVISOR_EXTRA_MOUNTS: Additional bind mount flags for the docker-in-docker supervisor # * PASSWORDLESS_DROPBEAR: For run-supervisor - start a passwordless ssh daemon in the docker-in-docker supervisor # * CONTAINER_NAME: For run-supervisor, specify the container name for the docker-in-docker container (default: resin_supervisor_1) +# * CONFIG_FILENAME: For run-supervisor, specify the filename to mount as config.json, relative to tools/dind/ (default: config.json) # THIS_FILE := $(lastword $(MAKEFILE_LIST)) @@ -78,9 +79,10 @@ IMAGE ?= resin/$(ARCH)-supervisor:master SUPERVISOR_IMAGE ?= resin/$(ARCH)-supervisor:master PASSWORDLESS_DROPBEAR ?= false CONTAINER_NAME ?= resin_supervisor_1 +CONFIG_FILENAME ?= config.json # Bind mounts and variables for the run-supervisor target -SUPERVISOR_DIND_MOUNTS := -v $$(pwd)/../../:/resin-supervisor -v $$(pwd)/config.json:/mnt/conf/config.json -v $$(pwd)/config/env:/usr/src/app/config/env -v $$(pwd)/config/localenv:/usr/src/app/config/localenv +SUPERVISOR_DIND_MOUNTS := -v $$(pwd)/../../:/resin-supervisor -v $$(pwd)/$(CONFIG_FILENAME):/mnt/conf/config.json -v $$(pwd)/config/env:/usr/src/app/config/env -v $$(pwd)/config/localenv:/usr/src/app/config/localenv ifeq ($(OS), Linux) SUPERVISOR_DIND_MOUNTS := ${SUPERVISOR_DIND_MOUNTS} -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /bin/kmod:/bin/kmod endif diff --git a/dindctl b/dindctl index 6385f412..1761cc82 100755 --- a/dindctl +++ b/dindctl @@ -24,8 +24,9 @@ # --dind-container [name] container name for the dind host container ( default: resin_supervisor_1 ) # --mount-dist bind-mount './dist/' (where webpack stores the built js) from local development environment into supervisor container. # --mount-nm bind-mount './node_modules/' from local development environment into supervisor container. -# --preload | -p use tools/dev/apps.json to preload an application image into the dind host. +# --preload | -p use tools/dev/apps.json to preload an application image into the dind host. # --ssh enable a passwordless dropbear ssh server on the dind host +# --config | -c [file] path to config.json, relative to tools/dind ( default: config.json ) # # See README.md for examples. # @@ -49,6 +50,7 @@ DIND_IMAGE="resin-supervisor-dind" CONTAINER_NAME="resin_supervisor_1" PRELOADED_IMAGE="" OPTIMIZE="true" +CONFIG_FILENAME="config.json" function showHelp { cat $THIS_FILE | awk '{if(/^#/)print;else exit}' | tail -n +2 | sed 's/\#//' | sed 's|dindctl|'$THIS_FILE'|' @@ -75,6 +77,10 @@ function parseOptions { SUPERVISOR_IMAGE="$2" shift || { echo "--image provided not specified" && exit 1; } ;; + -c|--config) + CONFIG_FILENAME="$2" + shift || { echo "--config provided not specified" && exit 1; } + ;; --dind-image) DIND_IMAGE="$2" shift || { echo "--dind-image provided not specified" && exit 1; } @@ -143,6 +149,7 @@ function runDind { PRELOADED_IMAGE="$PRELOADED_IMAGE" \ IMAGE="$DIND_IMAGE" \ CONTAINER_NAME="$CONTAINER_NAME" \ + CONFIG_FILENAME="$CONFIG_FILENAME" \ run-supervisor }