Skip to content

A Docker image for creating Arch Linux package repositories

License

Notifications You must be signed in to change notification settings

mserajnik/arch-repo-create

Repository files navigation

arch-repo-create GitHub Actions status

A Docker image for creating Arch Linux package repositories

This Docker image provides an easy way to create and manage Arch Linux package package repositories. It is based on the official Arch Linux image and builds packages using makepkg before adding them to a repository via repo-add. Dependencies are installed with pikaur and can therefore also come from the AUR. Both the packages and the repository can optionally be signed by providing a GPG key.

The primary use case are CI/CD platforms that don't have an Arch Linux environment available by default. See my personal repository for an example of how this image can be utilized in a GitHub Actions workflow.

Usage

To get started, clone the Git repository and create a copy of the Docker Compose example configuration:

git clone https://github.com/mserajnik/arch-repo-create.git
cd arch-repo-create
cp ./compose.yaml.example ./compose.yaml

Adjust the REPOSITORY_NAME environment variable in your compose.yaml as you like. Optionally, you can also pass a GPG private key to the container which will cause the packages and the repository to be signed. To do this, you need to base64-encode the key. E.g., like this:

gpg --export-secret-key <key ID> | base64

Then, copy the output and paste it as value for the GPG_PRIVATE_KEY environment variable. If your GPG key is protected by a passphrase, you also need to set GPG_PASSPHRASE accordingly.

Next, copy the packages you want to build and add to the repository to the ./packages directory. Each package must be in its own subdirectory and contain (at least) a PKGBUILD file, like this:

tree ./packages
./packages/
└── example-package
    └── PKGBUILD

Finally, run the container:

docker compose run --rm build

Do not use docker compose up; the container is not supposed to keep running after the one-off command has finished executing. Here, Docker Compose is used mainly to have an easy way to start the container, considering how long the base64 GPG key is and how cumbersome it would be to pass it via the command line.

After the container has exited, the repository files will be inside the ./repository directory. Simply deploy these files to a web server to host your repository and add it to your Arch Linux system by editing your /etc/pacman.conf. E.g., for a signed repository with the default name arch-repo:

[arch-repo]
SigLevel = Required DatabaseRequired TrustedOnly
Server = https://your-domain.com/

Recreating the repository

If you want to cleanly recreate the repository from scratch, delete all the files from the ./repository directory before running the container again:

rm -rf ./repository/*
docker compose run --rm build

Otherwise, the existing repository will be updated instead and old package versions will be kept.

Maintainer

Michael Serajnik

Contribute

You are welcome to help out!

Open an issue or make a pull request.

License

AGPL-3.0-or-later © Michael Serajnik

About

A Docker image for creating Arch Linux package repositories

Topics

Resources

License

Stars

Watchers

Forks

Packages