#!/bin/bash GCP_PROJECT=${1:-fcuny-devel} DOCKER_MACHINE_NAME=${2:-gcp} COMMAND=$1 usage() { echo "$0: [create|start|stop|status|ssh|scp|tmux-status]" >&2 exit 1 } __create() { docker-machine create "${DOCKER_MACHINE_NAME}" \ -d google \ --google-project="${GCP_PROJECT}" \ --google-machine-type n1-highcpu-4 } __start() { docker-machine start "${DOCKER_MACHINE_NAME}" } __stop() { docker-machine stop "${DOCKER_MACHINE_NAME}" } __status() { docker-machine status "${DOCKER_MACHINE_NAME}" } __ssh() { docker-machine ssh "${DOCKER_MACHINE_NAME}" } __scp() { echo "This is not implemented yet." exit 2 } __tmux-status() { [ $(__status) == 'Running' ] && echo "Docker GCP up" } if [[ -z "${COMMAND}" ]]; then usage fi case "${COMMAND}" in create) __create ;; start) __start ;; stop) __stop ;; status) __status ;; ssh) __ssh ;; scp) __scp ;; tmux-status) __tmux-status ;; *) usage ;; esac