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!

The Stateless Development Machine

6 thoughts on “The Stateless Development Machine

  1. For node, if you are relying on global packages like forever,pm2 or even jest – you are wasting time with this.

  2. 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

Your email address will not be published. Required fields are marked *

Scroll to top