Files
dokku/plugins/00_dokku-standard/commands
T
Paul Lietar 27d4bc8c3c Replace gitreceive by a git plugin.
This removes the need for two distinct users.
Git pushes and dokku commands are sent using the same user.
2013-10-28 21:15:17 +00:00

66 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e; case "$1" in
delete)
if [[ -z $2 ]]; then
echo "Please specify an app to delete"
exit 1
fi
APP="$2"; IMAGE="app/$APP";
if [[ ! -d "$HOME/$APP" ]]; then
echo "App does not exist"
exit 1
fi
pluginhook pre-delete $APP
ID=$(< "$HOME/$APP/CONTAINER")
docker stop $ID > /dev/null
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
docker rm $ID > /dev/null
pluginhook post-delete $APP
;;
logs)
CONTAINER=$(<$HOME/$2/CONTAINER)
docker logs $CONTAINER | tail -n 100
;;
run)
if [[ -z $2 ]]; then
echo "Please specify an app to run the command on"
exit 1
fi
APP="$2"; IMAGE="app/$APP"
if [[ ! -d "$HOME/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
shift 2
docker run -i -t $IMAGE /exec "$@"
;;
url)
APP="$2";
if [[ ! -d "$HOME/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
if [[ -f "$HOME/$APP/URL" ]]; then
echo $(< "$HOME/$APP/URL")
fi
;;
help)
cat && cat<<EOF
delete <app> Delete an application
logs <app> Show the last logs for an application
run <app> <cmd> Run a command in the environment of an application
url <app> Show the URL for an application
EOF
;;
esac
cat