core-env/functions

89 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2017-08-27 15:11:07 -06:00
# Stuff to make Cloud OS / Container Linux
# less type-tastic
2017-09-10 21:33:19 -06:00
dh () {
2017-08-27 15:11:07 -06:00
docker run \
-e TERM \
-e HOME \
-v $HOME:$HOME \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-u $(id -u):$(id -g) \
--log-driver=none \
"$@"
}
irssi () {
id=$(docker ps -q -f name=irssi)
if [ -z "$id" ]; then
2017-10-31 09:25:49 -06:00
dh -d -it --name irssi irssi
2017-08-27 15:11:07 -06:00
fi
docker attach irssi
2017-09-10 21:33:19 -06:00
echo
2017-08-27 15:11:07 -06:00
}
alias dev_appserver.py="_dev_appserver"
_dev_appserver () {
appdir=$1; shift
docker run \
--rm \
-p 8080:8080 \
-p 8000:8000 \
2017-09-10 21:33:19 -06:00
-v $appdir:/app:ro \
2017-08-27 15:11:07 -06:00
google/cloud-sdk \
dev_appserver.py --host=0.0.0.0 --admin_host=0.0.0.0 /app "$@"
}
2017-11-09 10:02:03 -07:00
unalias gcloud 2>/dev/null
2017-11-09 10:01:28 -07:00
gcloud () {
2017-11-09 10:08:38 -07:00
docker run \
2017-11-09 10:01:28 -07:00
--rm \
-it \
--net=host \
-v $HOME/.config:/root/.config \
2017-11-09 10:01:28 -07:00
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker:ro \
google/cloud-sdk gcloud "$@"
}
2017-08-27 15:11:07 -06:00
dbtl () {
2017-09-10 21:33:19 -06:00
dh \
--rm \
-it \
-w "$(pwd)" \
2017-10-31 09:25:49 -06:00
dirtbags/dbtl "$@"
2017-08-27 15:11:07 -06:00
}
backup () {
2017-09-10 21:33:19 -06:00
dh \
--rm \
2017-09-10 21:46:50 -06:00
google/cloud-sdk gsutil rsync \
2017-09-10 21:33:19 -06:00
-r \
-d \
2017-09-10 21:46:50 -06:00
-x 'tmp/|src/|go/|.ssh/authorized_keys|.viminfo' \
2017-09-10 21:33:19 -06:00
$HOME \
gs://neale-private/fozzie
echo
}
go () {
dh \
--rm \
-e GOPATH=$HOME/go \
-w "$(pwd)" \
golang:1.6 go "$@"
2017-08-27 15:11:07 -06:00
}
2017-09-10 21:33:19 -06:00
docker-compose () {
docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):$(pwd) \
--rm \
--workdir $(pwd) \
docker/compose:1.16.1 "$@"
}