|
GIST_URL='https://gist.githubusercontent.com/astrohckr/0d5303b787a449cd564f/raw' |
|
|
|
setup_shell() { |
|
[ -f ~/.profile ] && \ |
|
mv ~/.profile{,.backup} && \ |
|
echo "Created backup of existing ~/.profile to ~/.profile.backup" |
|
|
|
curl $GIST_URL/profile -o ~/.profile && echo "Setup $SHELL" |
|
|
|
if [[ $SHELL == *"zsh"* ]]; |
|
then |
|
[ -f ~/.zprofile ] && mv ~/.zprofile{,.backup} |
|
curl $GIST_URL/zprofile -o ~/.zprofile |
|
fi |
|
} |
|
|
|
setup_docker_machine() { |
|
## Prerequisites |
|
echo 'Installing xhyve, docker, docker-compose, and go' |
|
brew install xhyve docker docker-compose go |
|
|
|
## Set up Go |
|
echo 'Setting up go directories' |
|
mkdir ~/.go |
|
|
|
## Set up shell |
|
if [[ $SHELL == *"zsh"* ]]; then |
|
shellrc=$HOME/.zshrc |
|
else |
|
shellrc=$HOME/.bashrc |
|
fi |
|
echo 'export GOPATH=$HOME/.go' >> $shellrc |
|
source $shellrc |
|
|
|
## Install docker-machine |
|
go get github.com/docker/machine |
|
cd $GOPATH/src/github.com/docker/machine |
|
make build |
|
make install |
|
|
|
## Install docker-machine xhyve |
|
export GO15VENDOREXPERIMENT=1 |
|
go get -u github.com/zchee/docker-machine-driver-xhyve |
|
cd $GOPATH/src/github.com/zchee/docker-machine-driver-xhyve |
|
make build |
|
make install |
|
sudo chown root:wheel $GOPATH/bin/docker-machine-driver-xhyve |
|
sudo chmod u+s $GOPATH/bin/docker-machine-driver-xhyve |
|
|
|
## Create the xhyve machine |
|
docker-machine create dev --driver xhyve --xhyve-experimental-nfs-share |
|
|
|
mkdir -p ~/Library/LaunchAgents |
|
|
|
curl $GIST_URL/com.docker.machine.dev.plist -o\ |
|
~/Library/LaunchAgents/com.docker.machine.dev.plist && \ |
|
echo "Setup docker-machine to launch on startup" |
|
} |
|
|
|
setup_shell |
|
setup_docker_machine |
|
|
|
echo "Now, reboot." |