summary refs log tree commit diff
path: root/bin/docker-gcp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/docker-gcp')
-rwxr-xr-xbin/docker-gcp67
1 files changed, 67 insertions, 0 deletions
diff --git a/bin/docker-gcp b/bin/docker-gcp
new file mode 100755
index 0000000..3136fee
--- /dev/null
+++ b/bin/docker-gcp
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+GCP_PROJECT=${1:-fcuny-devel}
+DOCKER_MACHINE_NAME=${2:-gcp}
+
+COMMAND=$1
+
+usage() {
+  echo "$0: [create|start|stop|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
+}
+
+if [[ -z "${COMMAND}" ]]; then
+  usage
+fi
+
+case "${COMMAND}" in
+  create)
+    __create
+    ;;
+  start)
+    __start
+    ;;
+  stop)
+    __stop
+    ;;
+  status)
+    __status
+    ;;
+  ssh)
+    __ssh
+    ;;
+  scp)
+    __scp
+    ;;
+  *)
+    usage
+    ;;
+esac