CLI toolkit for bundling AWS Lambda layers
Project description
LAYERMAKE
layermake is a CLI tool for creating AWS Lambda layers
layermake currently supports creating python, NodeJS, and binary layers.
Requirements
Currently layermake has only been tested on Python >= 3.8
Installation:
Install from pypi: pip install layermake
or install from source:
git clone or download this repository and install with:
pip install .
The binary should now be installed and can be invoked with:
layermake COMMAND [ARGS]
Usage:
run layermake
with one of the following commands:
nodejs
python
binary
layermake nodejs
and layermake python
support fully interactive layer building if no
arguments are passed.
All commands share the following options:
-n, --name TEXT layer name
-l, --license TEXT text to include in the license field of the layer
--license-file TEXT file containing license info to include in the license field of the layer
-a, --arch [x86_64|arm64] architectures this layer is compatible with
--profile TEXT AWS profile to use when publishing
-d, --description TEXT description of the layer
-v, --verbose verbose output
-q, --quiet quiet output. Only display errors and warnings. Turn off animations.
--no-publish do not publish the layer, only bundle.
--no-zip do not publish the layer, and do not zip the bundled layer.
NodeJS bundling
To interactively bundle a NodeJS layer with defaults use:
layermake nodejs
All NodeJS bundling options as displayed with layermake nodejs --help
To use a package.json file use the option --manifest
or -m
:
layermake nodejs -n "my nodejs layer" -r 14.x -m package.json
Usage: layermake nodejs [OPTIONS] [PACKAGES]...
Options:
-n, --name TEXT layer name
-l, --license TEXT text to include in the license field of the layer
--license-file TEXT file containing license info to include in the license field of the layer
-a, --arch [x86_64|arm64] architectures this layer is compatible with
--profile TEXT AWS profile to use
-d, --description TEXT description of the layer
-v, --verbose verbose output
-q, --quiet quiet output. Only display errors and warnings. Turn off animations.
--no-publish do not publish the layer, only bundle.
--no-zip do not publish the layer, and do not zip the bundled layer.
-r, --runtime TEXT nodejs runtime
-m, --manifest TEXT nodejs manifest file (package.json)
-o, --output TEXT target output directory [default: layer]
--container TEXT use the provided docker container to build the layer
--dir TEXT directory containing artifacts to bundle into a layer
--help Show this message and exit.
Python bundling
To interactively bundle a Python layer with defaults use:
layermake python
All Python bundling options as displayed with layermake python --help
Usage: layermake python [OPTIONS] [PACKAGES]...
Options:
-n, --name TEXT layer name
-l, --license TEXT text to include in the license field of the layer
--license-file TEXT file containing license info to include in the license field of the layer
-a, --arch [x86_64|arm64] architectures this layer is compatible with
--profile TEXT AWS profile to use
-d, --description TEXT description of the layer
-v, --verbose verbose output
-q, --quiet quiet output. Only display errors and warnings. Turn off animations.
--no-publish do not publish the layer, only bundle.
--no-zip do not publish the layer, and do not zip the bundled layer.
-r, --runtime TEXT python runtime
-m, --manifest TEXT python manifest file (requirements.txt)
-o, --output TEXT target output directory [default: layer]
--dir TEXT directory containing artifacts to bundle into a layer
--container TEXT use the provided docker container to build the layer
--help Show this message and exit.
Binary bundling
Binary bundling requires an argument specifying either a build script or a directory
where either a makefile exists or one of build
, install
, layer
, build-layer
exists
(with or without a .sh
file extensions). If none of these files are provided, you may
pass a custom container command to run instead (e.g. /bin/bash my_script.sh
).
When bundling a binary layer, the build script is responsible for installing
libraries and binaries inside /opt/bin
and/or /opt/lib
. These directories
are zipped inside Docker after running the build script.
Currently, only Docker images that provide yum
package manager are supported as
yum
is used to install build tools in the base image (defaults to amazonlinux:latest
)
To add any prerequisite packages not installed by the build script use the --packages
flag to have them installed before bundling.
Example:
layermake binary -n 'GnuPG 2.8' -p zlib gnupg-build.sh
Usage: layermake binary [OPTIONS] [ARTIFACT]...
Options:
-n, --name TEXT layer name
-l, --license TEXT text to include in the license field of the layer
--license-file TEXT file containing license info to include in the license field of the layer
-a, --arch [x86_64|arm64] architectures this layer is compatible with
--profile TEXT AWS profile to use
-d, --description TEXT description of the layer
-v, --verbose verbose output
-q, --quiet quiet output. Only display errors and warnings. Turn off animations.
--no-publish do not publish the layer, only bundle.
--no-zip do not publish the layer, and do not zip the bundled layer.
--dockerfile TEXT use the provided dockerfile for bundling
-o, --output TEXT target output directory [default: layer]
-w, --workdir TEXT workdir used when bundling inside the container [default: /opt]
-c, --cmd TEXT command executed inside the container; defaults to executing the build artifact with /bin/bash
--base-image TEXT use the provided base docker image when compiling the Dockerfile for lambda bundling
[default: amazonlinux:latest]
-p, --packages TEXT additional packages to install in the container; currently only yum is supported
-r, --runtimes [nodejs|nodejs4.3|nodejs6.10|nodejs8.10|nodejs10.x|nodejs12.x|nodejs14.x|nodejs16.x|java8|java8.al2|java11|python2.7|python3.6|python3.7|python3.8|python3.9|dotnetcore1.0|dotnetcore2.0|dotnetcore2.1|dotnetcore3.1|dotnet6|nodejs4.3-edge|go1.x|ruby2.5|ruby2.7|provided|provided.al2|nodejs18.x|all] compatible runtimes
--help Show this message and exit.
Todo:
- comprehensive unit testing
- rust support
- java support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for layermake-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f4fb37e26345bc3a6068bd44bde7c2fc47c8fead06d0c2c49cc8de365ebfc67 |
|
MD5 | f7eecc073a4e9c2cf72b334af2315abe |
|
BLAKE2b-256 | bfb1d65009049e0b730c93f130fdaa3e9d2307d37b5950d1e493f2c5c3e567fb |