chainguard-dev / rules_apko

Bazel rules for apko
https://apko.dev
Apache License 2.0
24 stars 15 forks source link

Guidance: Adding a locally build .apk package #58

Open aj185259 opened 6 months ago

aj185259 commented 6 months ago

Hi all,

I'm using rules_apko to build our Alpine images, but any that require an apk package not provided by an online mirror doesn't seem to be possible. For instance if I wanted to build a melange built package or a package built by one of our other teams, it doesn't seem to be able to accommodate that.

The closest I've gotten is being able to apko lock a local package, but it can't make its way into the apko_image via the lockfile.

Any thoughts or guidance on this would be greatly appreciated.

Thanks!

sfc-gh-mhazy commented 4 months ago

I think this is currently not supported but it sounds like a good feature request.

The changes needed would be non trivial though. The place where the "remote package" is assumed is https://github.com/chainguard-dev/rules_apko/blob/1d78765293a0baf3f92ca49efa51d6c02b9c828e/apko/private/apk.bzl#L42C5-L42C21

There are analogous rules for apk_repository and apk_keyring

All of these are used in translate_apko_lock (https://github.com/chainguard-dev/rules_apko/blob/1d78765293a0baf3f92ca49efa51d6c02b9c828e/apko/translate_lock.bzl#L87). I think there or in apk_import would need to be some logic to distinguish local from remote packages.