#!/bin/sh # # NAME # bootstrap -- initialize/update docker environment # # SYNOPSIS # bootstrap # bootstrap shellinit # # DESCRIPTION # Execute this script without parameters to build the local docker # environment. Once bootstrapped, dependent services are running # via docker-compose and the environment variables are written to # *build/test-environment* for future use. # # Running this script with the _shellinit_ command line parameter # causes it to simply interrogate the running docker environment, # update *build/test-environment*, and print the environment to # the standard output stream in a shell executable manner. This # makes the following pattern for setting environment variables # in the current shell work. # # prompt% $(./bootstrap shellinit) # # vim: set ts=2 sts=2 sw=2 et: PROJECT=sprockets if test -e /var/run/docker.sock then DOCKER_IP=127.0.0.1 else echo "Failed to initialize docker environment" exit 2 fi get_exposed_port() { docker-compose port $1 $2 | cut -d: -f2 } build_env_file() { cat > $1<