The Stateless Development Machine

Are you spending 2-3 hours and sometimes a day getting your new laptop ready for the development? I used to do it with ansible and be happy about it. With Docker, it has now become easier. I have following in my .zshr and it works pretty great.

The .zshrc aliases

alias npm='docker run -ti --rm -v $(pwd):/src:rw -e "PUID=$UID" -e "PGID=$GID" mkenney/npm:latest npm'
alias gulp='docker run -ti --rm -v $(pwd):/src:rw -e "PUID=$UID" -e "PGID=$GID" mkenney/npm:latest gulp'
alias node='docker run -ti --rm -v $(pwd):/src:rw -e "PUID=$UID" -e "PGID=$GID" mkenney/npm:latest node'
alias bower='docker run -ti --rm -v $(pwd):/src:rw -e "PUID=$UID" -e "PGID=$GID" mkenney/npm:latest bower'
alias bundle='docker run -ti --rm -v $(pwd):/src:rw -e "PUID=$UID" -e "PGID=$GID" rails:latest bundle'
alias composer='docker run -ti --rm -v $(pwd):/app:rw -e "PUID=$UID" -e "PGID=$GID" composer:latest composer'
alias go='docker run -ti --rm  -w /usr/src/myapp -v $(pwd):/usr/src/myapp:rw -e "PUID=$UID" -e "PGID=$GID" golang:latest go'
alias nghttp='docker run --rm -it dajobe/nghttpx nghttp'
function dbash() {
    docker exec -it $1 /bin/bash
}
alias dbash=dbash

Understanding

Obviously, the list can go on but understanding here is to keep your system in a stateless mode. Simply by having dotfiles backup, you can move your system with no trouble. Now days everything is in Git already!

Tell your network!

9 Comments

  1. I am sure in few months developers will prefer having the USB 3 PC instead of having portable docker related environment. The portability demanded first dotfiles repository and then docker images. Now what makes most sense is to have lighter tools like SpaceVim and a USB Portable PC which you can snap to any monitor or just boot random PC.

  2. I have now everything inside Docker and I use different entry points to different editors. A 4G file is still portable enough to be on drive and code anywhere anytime.

  3. You can buy a server in linode and make it a development machine. You can back it up and access it from anywhere in the world. It will speed up your development.

Leave a Reply to K. Saini

Click here to cancel reply.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>