/apk-builder

A Docker image for building apk packages for alpine

Primary LanguageShellMIT LicenseMIT

apk-builder

Build Status Docker Pulls Docker Stars MicroBadger Layers (tag) MicroBadger Size (tag) License: MIT dockeri.co

Build your own package for Alpine.

What is an alpine package

More infos on Alpine packages :

RSA keys

Create a new key pair

Declare RSA_KEY_NAME environment variable with a name to give to your key and a new key pair will be generated in /config folder.

Use your own key

To use your own key, place your public and private key in /config folder.
Then declare the following environment variable:

  • RSA_KEY_NAME: This is the name given to your key (Exemple: my-key.rsa)
  • PACKAGER_PRIVKEY: Path to your private key (Exemple: /config/my-key.rsa.priv)
  • PACKAGER_PUBKEY: Path to your public key (Exemple: /config/my-key.rsa.pub)

Your public key is automatically copied to /etc/apk/keys/ inside the container and to /public folder.

Usage

Create your package

Create your package with an APKBUILD file and place it in your packages folder
Run apk-builder to generate your package(s).
The resulting apk file and signed index can be found in public folder

    docker run -t --rm \
        -v $PWD/config:/config \
        -v $PWD/packages:/packages \
        -v $PWD/public:/public \
        dsuite/apk-builder:3.11 package

See: hugo-apk example for more details.

Or with an existing RSA key

    docker run \
	    -e RSA_KEY_NAME="my-key.rsa" \
        -e PACKAGER_PRIVKEY="$PWD/config/my-key.rsa.pub" \
        -e PACKAGER_PUBKEY="$PWD/config/my-key.rsa.priv" \
        -v $PWD/packages:/packages \
        -v $PWD/public:/public \
        dsuite/apk-builder:3.11 package

This would build the packages in your $PWD/packages local folder, and place the resulting packages in the $PWD/public/v3.11/x86_64 folder.

Generate new key pair:

docker run --rm -t -e RSA_KEY_NAME="my-key.rsa" -v $PWD/config:/config dsuite/apk-builder

Examples

Two examples can be found in the .example folder

  • hugo-apk: Build Hugo package from source.
  • hugo-alpine: Create an alpine image with hugo using multistage.