1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-21 11:42:28 +00:00

Zsh+Docker

This commit is contained in:
J. Fernando Sánchez 2015-04-09 01:30:27 +02:00
parent 882172bccf
commit 8dbafa6971
3 changed files with 36 additions and 16 deletions

View File

@ -30,19 +30,25 @@ ENV PATH /home/dev/bin:$PATH
RUN mkdir /var/shared/ RUN mkdir /var/shared/
RUN touch /var/shared/placeholder RUN touch /var/shared/placeholder
RUN chown -R dev:dev /var/shared RUN chown -R dev:dev /var/shared
VOLUME /var/shared RUN mkdir -p /usr/src/app/
RUN touch /usr/src/app/nocode
RUN chown -R dev:dev /usr/src/app
VOLUME /usr/src/app
WORKDIR /home/dev WORKDIR /home/dev
ENV HOME /home/dev ENV HOME /home/dev
ADD . /home/dev/dotfiles RUN git clone https://github.com/balkian/dotfiles /home/dev/dotfiles
RUN sh /home/dev/dotfiles/make.sh RUN sh /home/dev/dotfiles/make.sh
# Link in shared parts of the home directory # Link in shared parts of the home directory
RUN ln -s /var/shared/.ssh RUN ln -s /var/shared/.ssh
RUN ln -s /var/shared/src RUN ln -s /usr/src/app
RUN chsh dev -s /usr/bin/zsh RUN chsh dev -s /usr/bin/zsh
RUN chown -R dev: /home/dev RUN chown -R dev: /home/dev
RUN chown -R dev: /usr/local/ RUN chown -R dev: /usr/local/
ENTRYPOINT ["/usr/bin/zsh", "-i"]
WORKDIR /home/dev/app
ENTRYPOINT ["zsh"]
USER dev USER dev

20
make.sh
View File

@ -6,32 +6,28 @@
########## Variables ########## Variables
# dotfiles directory
dir=`dirname $0`
# change to the dotfiles directory # change to the dotfiles directory
echo "Changing to the $dir directory" cd `dirname $0`
cd $dir
echo "...done"
########## Don't forget the submodules ########## Don't forget the submodules
git submodule init git submodule init
git submodule update --recursive git submodule update --recursive
olddir=~/dotfiles$(date +%Y-%m-%d_%H:%M:%S) # old dotfiles backup directory olddir=~/dotfiles$(date +%Y-%m-%d_%H:%M:%S) # old dotfiles backup directory
files=$(ls --ignore="not_dots" --ignore="README.md" --ignore="make.sh" --ignore="DevDockerfile" $dir) # list of files/folders to symlink in homedir files=$(ls --ignore="not_dots" --ignore="README.md" --ignore="make.sh" --ignore="Docker" $PWD) # list of files/folders to symlink in homedir
########## ##########
# create dotfiles_old in homedir # create dotfiles_old in homedir
echo "Creating $olddir for backup: of any existing dotfiles in ~" echo "** Creating $olddir for backup: of any existing dotfiles in ~"
mkdir -p $olddir mkdir -p $olddir
echo "...done" echo "...done"
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks # move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
echo "** Creating symlinks. Any existing dotfiles will be moved to: $olddir"
for file in $files; do for file in $files; do
echo "Moving any existing dotfiles from ~ to $olddir" mv ~/.$file $olddir && echo "Backed up: ~/.$file"
mv ~/.$file $olddir ln -s $PWD/$file ~/.$file
echo "Creating symlink to $file in home directory."
ln -s $dir/$file ~/.$file
done done
rmdir $olddir 2>/dev/null && echo "Backup dir empty. Removed"

18
zshrc
View File

@ -50,6 +50,24 @@ alias e='myemacs -nw'
alias ew='myemacs -n' alias ew='myemacs -n'
export ALTERNATE_EDITOR=/usr/bin/vim EDITOR="vim" VISUAL="vim" export ALTERNATE_EDITOR=/usr/bin/vim EDITOR="vim" VISUAL="vim"
# Docker goodies
alias drm="docker rm"
alias drmi="docker rmi"
alias dps="docker ps"
alias dpi="docker images"
function da () {
docker start $1 && docker attach $1
}
function drmia () {
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
}
function drma () {
docker rm $(docker ps -q $*)
}
function newdev () {
docker run -v $PWD:/usr/src/app -t -i --name $1 -h $1 balkian/devmachine
}
PYTHONSTARTUP=~/.pythonrc.py PYTHONSTARTUP=~/.pythonrc.py
export PYTHONSTARTUP export PYTHONSTARTUP
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'; alias mosh='ssh-add -l >/dev/null || ssh-add && unalias mosh; mosh' ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'; alias mosh='ssh-add -l >/dev/null || ssh-add && unalias mosh; mosh'