Alpine Package Builder
This is a Docker image for building Alpine Linux packages.
The builder is typically run from your Alpine Linux package source directory (changing
~/.abuild/abuild.rsa to your packager private key location):
docker run -e RSA_PRIVATE_KEY="$(cat ~/.abuild/abuild.rsa)" -v $(pwd):/home/builder/package -v $(pwd)/packages:/home/builder/packages andyshinn/alpine-abuild
This would build the package at your current working directory, and place the resulting packages in
packages at your current working directory.
You can also run the builder anywhere. You just need to mount your package source and build directories to
There are a number of environment variables you can change at package build time:
RSA_PRIVATE_KEY: This is the contents of your RSA private key. This is optional. You should use
PACKAGER_PRIVKEYand mount your private key if not using
RSA_PRIVATE_KEY_NAME: Defaults to
ssh.rsa. This is the name we will set the private key file as when using
RSA_PRIVATE_KEY. The file will be written out to
PACKAGER_PRIVKEY: Defaults to
/package/abuild.rsa. This is generally used if you are bind mounting your private key instead of passing it in with
REPODEST: Defaults to
/packages. If you want to override the destination of the build packages.
PACKAGER: Defaults to
Glider Labs <email@example.com>. This is the name of the package used in package metadata.
You can use this image to generate keys if you don't already have them. Generate them in a container using the following command (replacing
Glider Labs <firstname.lastname@example.org> with your own name and email):
docker run --name keys --entrypoint abuild-keygen -e PACKAGER="Glider Labs <email@example.com>" andyshinn/alpine-abuild -n
You'll see some output like the following:
Generating RSA private key, 2048 bit long modulus .............................................+++ .................................+++ e is 65537 (0x10001) writing RSA key >>> >>> You'll need to install /firstname.lastname@example.org into >>> /etc/apk/keys to be able to install packages and repositories signed with >>> /email@example.com >>> >>> You might want add following line to /home/builder/.abuild/abuild.conf: >>> >>> PACKAGER_PRIVKEY="/firstname.lastname@example.org" >>> >>> >>> Please remember to make a safe backup of your private key: >>> /email@example.com >>>
This output contains the path to your public and private keys. Copy the keys out of the container:
mkdir ~/.abuild docker cp keys:/firstname.lastname@example.org ~/.abuild/ docker cp keys:/email@example.com ~/.abuild/
Put your key files in a same place and destroy this container:
docker rm -f keys
Check out https://github.com/andyshinn/alpine-pkg-glibc for an example package that gets built using this.