Build [BorgBackup] binaries on any platform, for any architecture, using docker.
## Usage
### Build image
`./build.sh <arch> [<version>]`
See the [list of available architectures] ([on GitHub][available-architectures-github])
*Examples:*
- Build version `1.1.7` for `aarch64`
`./build.sh aarch64 1.1.7`
- Build version `1.1.5` for Raspberry Pi 3
`./build.sh raspberrypi3 1.1.5`
### Extract borg binary
`./extract.sh <arch> [<binary_save_location>]`
**Note:** This will overwrite the file at `binary_save_location` if it already exists!
*Examples:*
- Extract borg binary for `aarch64` to `borg-aarch64` in current folder
`./extract.sh aarch64 borg-aarch64`
- Extract borg binary for Raspberry Pi 3 to `/homes/lemoi/borg`
`./extract.sh raspberrypi3 /homes/lemoi/borg`
## How this works
### Build
The `build.sh` script downloads the appropriate starter docker image that contains the necessary QEMU binary for building and registers it in the build agent.
For more details, check the [Hypriot blog post] that explains it in more depth.
Then, the docker image is built for the requested architecture.
This is basically done by following the flow of setting up a [BorgBackup development environment] and [creating the standalone binary]. (For more info on this, just have a look at the `Dockerfile`)
### Extract
The `extract.sh` script extracts the built binary from the image created using `build.sh`.
This basically starts a container from the built image for your selected architecture and writes the binary out to the file path you passed as a parameter.
[BorgBackup]:https://github.com/borgbackup/borg/"BorgBackup on GitHub"
[BorgBackup development environment]:https://borgbackup.readthedocs.io/en/stable/development.html#building-a-development-environment"BorgBackup development environment"
[creating the standalone binary]:https://borgbackup.readthedocs.io/en/stable/development.html#creating-standalone-binaries"Create standalone binary"
[list of available architectures]:https://docs.resin.io/reference/base-images/base-images/"List of available Architectures"
[available-architectures-github]:https://github.com/resin-io-library/base-images/tree/master/python"List of available Architectures on GitHub"
[Hypriot blog post]:https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/"Setup a simple CI pipeline to build Docker images for ARM"