ahgencer / docker-abuilder

Alpine Linux builder image with common build dependencies for compiling packages from source.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Builder Image for Alpine Linux

Docker Pulls GitHub Stars Issues
License Community Built

ahgencer/abuilder provides a Docker base image that contains common build dependencies for compiling Alpine Linux packages from source.

Interested? Here's how to get started.

What's inside the image?

Included Packages

These are the apk packages and other software provided by the image.

Component Description
Alpine Linux The base image. Built around musl libc and BusyBox for security and small sizes.
alpine-sdk Meta package for the Alpine Linux Software Development Kit.
build-base Meta package for building Alpine Linux packages.
git Version Control System for cloning software repositories.

Scripts

Useful scripts for automating the build process for Alpine Linux packages.

Component Description
buildpkg Iterates all directories in /opt and runs the script called build for each package.
fetchpkg Fetches the APKBUILD package information directly from the official Alpine Linux aports repository.

Getting started

Building the image

You can build the image yourself using Docker by simply running:

docker build -t ahgencer/abuilder:<tag> src/

To build the image instead using Podman / Buildah, run:

podman build --format=docker -t docker.io/ahgencer/abuilder:<tag> src/

You may also optionally pass in the ALPINE_VERSION build argument to specify the version of the base image to use.

Using the image

The image is meant to be used as an early build stage in a Dockerfile.

# Don't forget to lock the builder image to a specific major version!
ARG BUILDER_VERSION=1.0
ARG ALPINE_VERSION=latest

## Build stage 1: Patch and build custom `apk` packages
FROM ahgencer/abuilder:$BUILDER_VERSION AS builder

# Copy and build `apk` packages
COPY ./opt /opt
RUN buildpkg

## Build stage 2: Prepare files for the final image
FROM alpine:$ALPINE_VERSION

# Copy built packages and RSA public keys into image
COPY --from=builder --chown=root:root /home/builder/.abuild/builder-*.rsa.pub /etc/apk/keys/
COPY --from=builder /home/builder/packages/opt/**/* /opt/

License

This program is free software published under the MIT License. Feel free to use it in your own projects!

About

Alpine Linux builder image with common build dependencies for compiling packages from source.

License:MIT License


Languages

Language:Shell 70.6%Language:Dockerfile 29.4%