alpine-apk
v2.0.1
Published
access to alpine package manager
Downloads
2
Readme
alpine-apk
Use this package to read the contents of Alpine's package repository.
Usage:
import AlpineApk from 'alpine-apk'
/* by default:
version is 'latest-stable'. See versions here: http://dl-cdn.alpinelinux.org/alpine/
architecture is 'x86_64'
repos are ['main', 'community']
*/
const alpineApk = new AlpineApk();
await alpineApk.update(version, architecture, repos);
const nodeJs = alpineApk.get('nodejs');
/* nodeJs.version = '18.16.1-r0'
nodeJs.deps = [
'ca-certificates',
'/bin/sh',
'so:libbrotlidec.so.1',
'so:libbrotlienc.so.1',
'so:libc.musl-x86_64.so.1',
'so:libcares.so.2',
'so:libcrypto.so.3',
'so:libgcc_s.so.1',
'so:libicui18n.so.73',
'so:libicuuc.so.73',
'so:libnghttp2.so.14',
'so:libssl.so.3',
'so:libstdc++.so.6',
'so:libz.so.1'
]
*/
const nodeJsHash = alpineApk.getDependencyTree('nodejs');
/* => '[email protected],ca-certificates@20230506-r0,/bin/[email protected],[email protected],so:[email protected],so:[email protected]_p20230506-r0,[email protected]_p20230506-r0,so:[email protected],so:[email protected],so:[email protected],so:[email protected]_git20220924-r10,so:[email protected],[email protected],so:[email protected]_git20220924-r10,so:[email protected],so:[email protected],so:[email protected],'
*/
const allPackages = alpineApk.pkgs;
/* allPackages = {
nodejs: ... as above with get(),
etc, etc, (lots of packages!)
}
*/
Why use this?
I wanted to rebuild my docker images when nodejs and/or nodejs's dependencies updated on alpine. This allows me to do that:
import AlpineApk from 'alpine-apk'
const alpineApk = new AlpineApk();
await alpineApk.update();
const current = alpineApk.getDependencyTree('nodejs');
const previous = /* load the previous value somehow */
if (current !== previous) {
// nodejs, or one of the dependencies of nodejs, has changed.
// rebuild the image!
}