Skip to content
Snippets Groups Projects
Commit 084d2592 authored by nimrod's avatar nimrod
Browse files

Docker aliases!

A new shell script, `wrapper`, that (similar to what git does) in case an
excutable of the format `command-subcommand` is available (command being
the name called, $0), calling `command subcommand` will be call
`command-subcommand`. For example: calling `docker dev` will call
`docker-dev` if such an executable exists. So now `docker` (in
`~/Documents/bin/` is a symlink to `wrapper`. Changed my docker shell
aliases to scripts.
parent 1b8c9bca
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,6 @@ alias ecr-login='eval $(aws ecr get-login)'
alias hostlocal='docker run --rm --privileged --net=host gliderlabs/hostlocal'
alias apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --download-only --yes && apt-get autoclean'"
alias flatpak-daily='flatpak --user update --no-deploy'
alias docker-build='docker build -t "$(basename $PWD)" ./'
alias cdtemp='cd $(mktemp -d)'
alias 0-day-cleanup='ssh xbmc.shore.co.il "sudo -u debian-transmission find /srv/library/Comics -name *.part -path *0-Day\ Week\ of* -delete"'
alias httpbin='gunicorn httpbin:app'
......@@ -73,7 +72,7 @@ alias clean-swp="find \$HOME/ -name '*.swp' -delete"
alias unssh="ssh -o \"UserKnownHostsFile /dev/null\" -o \"StrictHostKeyChecking no\""
alias todo="vim \$HOME/Documents/TODO.yml"
alias sudo="sudo "
alias presentation='docker run -itv "$PWD:/project" adarnimrod/presentation'
alias presentation='docker dev adarnimrod/presentation'
alias prune_prerun='find "$HOME" -maxdepth 1 -name ".prerun.*" -print0 | grep -zv "$(pgrep -u "$(id -u)" bash)" | xargs -0r rm '
alias netdata='docker run --detach --name netdata --cap-add SYS_PTRACE --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/docker.sock:/var/run/docker.sock --publish 19999:19999 firehol/netdata'
alias json-tool='python3 -m json.tool'
......@@ -102,23 +101,6 @@ gen_csr () {
openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key"
}
docker_dev () {
local root repo uid
root="$(git rev-parse --show-toplevel)"
repo="$(basename "$root")"
uid="$(id -u)"
docker build -t "$repo:dev" "$root"
docker run --interactive \
--publish-all \
--name "$repo" \
--rm \
--tty \
--volume "$HOME:$HOME" \
--volume "$root:$root" \
--user "$uid" \
--workdir "$PWD" "$repo:dev" /bin/sh -l
}
sync_comics () {
local this_month last_month format
format='+xbmc.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*'
......
wrapper
\ No newline at end of file
#!/bin/sh
set -eu
docker build -t "$(basename "$PWD")" ./
#!/bin/sh
set -eu
docker run --rm -Pitv "$PWD:/volume" "$@"
#!/bin/sh
set -eu
basename="$(basename "$0")"
command="$(env -i which "$basename")" || { echo "$basename: not found"; exit 127; }
if alias="$(which "$basename-${1:-}")"
then
shift
"$alias" "$@"
else
"$command" "$@"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment