Docker as a Build Environment for Static Binaries

Forewarning: this repository exists primarily to save my future self some time and is not extensively documented. Maybe it will be fleshed out as this stuff gets reused by the aforementioned future self.

First, build the image:

$ cname=static-builder
$ docker build --tag ${cname} -f Dockerfile.builder .
$ docker create -it --name ${cname} ${cname} bash

Use the image with:

$ docker start ${cname}
$ docker exec -it ${cname} /bin/bash
$ docker stop ${cname}

Here's a basic ~/.bashrc:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PS1='[\u@\h:\w]\$ '
alias l='ls -la'
alias lh='ls -lat | head'
alias m='make'
alias clm='make clean'
alias cld='make distclean'
alias fst='fossil status'
export CC="ccache cc"

Install packages as needed with:

$ apk add package-name