API Documentation for nua-build
¶
Package nua.build
¶
Module nua.build.__main__
¶
Package nua.build.autobuild
¶
Package nua.build.autobuild.builders
¶
Module nua.build.autobuild.constants
¶
Package nua.build.autobuild.dockerfiles
¶
Module nua.build.autobuild.main
¶
Script to build Nua own images.
main ¶
main(
force=option_force,
download=option_download,
all=option_all,
verbose=option_verbose,
colorize=option_color,
version=option_version,
)
Nua-self-build CLI inferface.
Module nua.build.autobuild.nua_image_builder
¶
Module nua.build.autobuild.nua_wheel_builder
¶
Script to build Nua own images.
NuaWheelBuilder ¶
NuaWheelBuilder(wheel_path, download=False)
check_devel_mode ¶
check_devel_mode()
Try to find all required files locally in an up to date git repository.
Warning: only for devel tests
hack_agent_pyproject ¶
hack_agent_pyproject()
Since we use local path dependencies when making wheel, we need to force the
version deps to something local.
FIXME: to be solved by publishing to Pypi index.
Module nua.build.autobuild.register_builders
¶
Parse content of custom nua builders.
Docker builders are defined by a json file of properties and a Dockerfile.
Package nua.build.builders
¶
Builder class, core of build process.
Builder instance maintains config and other state information during build.
Typical use::
builder = get_builder(config_file)
builder.run()
Builder ¶
Builder(config, save_image=True)
Class to hold config and other state information during build.
merge_modules_in_config ¶
merge_modules_in_config()
Merge the module detailed definition in providers.
Modules are currently specialized images for DBs (postrgres, mariadb, …).
The key/values of modules can be superceded by provider statements.
BuilderError ¶
Builder error.
Module nua.build.builders.base
¶
Base class for builders.
May be refactored later into a more abstract base class.
BuilderError ¶
Builder error.
Builder ¶
Builder(config, save_image=True)
Class to hold config and other state information during build.
merge_modules_in_config ¶
merge_modules_in_config()
Merge the module detailed definition in providers.
Modules are currently specialized images for DBs (postrgres, mariadb, …).
The key/values of modules can be superceded by provider statements.
Module nua.build.builders.docker
¶
Docker builder (using dockerfile generated from the nua-config).
DockerBuilder ¶
DockerBuilder(config, save_image=True)
ensure_base_image_profile_availability ¶
ensure_base_image_profile_availability()
Ensure the required Nua images are available.
The tag ‘builder’ will determine the required base image if it represents an
Image. If empty, the standard Nua base image is used. The builder also be an
installation recipe.
select_base_image ¶
select_base_image()
Select a base image among possible choices.
It may append that we have 2 images for Node.js v14 and v16, and an app allowing
both version.
detect_nua_folder ¶
detect_nua_folder()
Detect folder containing nua files.
(Dockerfile, start.py, build.py, …)
copy_project_files ¶
copy_project_files()
Detect and copy files to build_dir.
- if no ‘src-url’, copy local source code from root_dir into build_dir
- if ‘src-url’ or other remote source, do not copy local code of root_dir
- if ‘manifest’ defined, copy manifest content to nua/src
- if /nua exists, copy it to nua (but not nua/src or nua-config)
- then copy required/default files to build_dir (nuaconfig, …)
Module nua.build.builders.factory
¶
Builder factory: create a Builder instance based on the nua-config.
BuilderFactory
dataclass
¶
Factory to create a Builder instance.
detect_container_type ¶
detect_container_type()
Placeholder for future container technology detection.
Currently only Docker is supported.
detect_build_method ¶
detect_build_method()
Detect how to build the container.
For now 2 choices:
- build: full build from generated Dockerfile
- wrap: use existing Docker image and add Nua metadata
Module nua.build.builders.wrap
¶
Module nua.build.config
¶
Package nua.build.default_conf
¶
Package nua.build.defaults
¶
Module nua.build.main
¶
Script to build a nua package (experimental)
- information come from a mandatory local file: “nua-config” (.toml, .json, .yaml)
- origin may be a source tar.gz or a git repository or a docker image…
- build locally or wrap docker image
Note: currently use “nua-build …” for command line.
See later if move this to “nua …”.
Module nua.build.module_definitions
¶
Package nua.build.provider_modules
¶
Package nua.build.scripts
¶
Module nua.build.scripts.test_replace_domain
¶
Utility script to replace a string in a file, typically ‘example.com’ to actual
domain in test files.
The original is not changed, but copied with changes made in a second
location.
- args 1: path of textfile containing replacement rules, see example below
- args 2: path of source file
- args 3: directory path for the replaced version of file
replacement rules, put a replacement per line, orig / replacement::
test.example.com test.yerom.xyz
test1.example.com test1.yerom.xyz
test2.example.com test2.yerom.xyz