summary refs log tree commit diff
path: root/bin/docker-gcp
blob: 3136fee422419b2e3b26285f614cd44ba6524629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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