apk2layer
flattens an alpine linux package(s) and its dependencies into a standalone tarball.
apk2layer [-mirror] PKGNAME... > layer.tar
apk2layer
flattens an alpine linux package(s) and its dependencies into a standalone tarball.
apk2layer [-mirror] PKGNAME... > layer.tar
set -e | |
[ $# -ge 2 ] || (echo 'usage: depy PACKAGES... DIRECTORY' ; false) | |
PACKAGES=${@:1:$(($#-1))} | |
DESTINATION=${!#} | |
TMPDIR=/tmp/depy.$$ | |
pip install -E $TMPDIR $PACKAGES | |
find $TMPDIR -type f -name "*.pyc" -delete | |
PACKAGES=$(pip freeze -E $TMPDIR | cut -d '=' -f 1 | xargs -n 1 -I @package@ find $TMPDIR -ipath '*/@package@/__init__.py' | sed -e s/__init__\.py//) | |
mkdir -p $DESTINATION | |
cp -R $PACKAGES $DESTINATION |