Scripts are located in build-env/inc/build-all/
.
Target definitions are located in build-env/target/
.
Each environment configuration file can/should implement below listed callbacks.
Directory is identified as environment (target) if it has packages.conf.sh
file inside and directory is not hidden.
ARCH
variable is exported before calling run_*
callbacks.
Directory is identified as target environment if it is in build-env/target
directory and there is packages.conf.sh
file in that directory. Name for
target environment is generated from directory names, for example from
build-env/target/centos/8/packages.conf.sh
the generated target name will be
centos/8
( instead of /
, also -
can be used, so centos-8
is also
correct).
The common
directory in build-env/target
should not have packages.conf.sh
as this directory is not target environment but contains files shared between
other targets.
Is called when environment is loaded (once per session)
Is called at the end of loading environment (after internal setup based on changes made in env_load
)
Is called before running docker on host machine to prepare docker execution (eg. create directories for volume mounts)
arg1: architecture name string
Return true
if arg1
architecture is supported in environment.
Returns true if current execution environment matches loaded one (used for environment detection when no --docker
switch was set)
arg1: build
or source
, can be ignored when build does not use split images
Create docker images. Usually calls docker_build_image PATH/TO/Dockerfile
.
arg1: build
or source
, can be ignored when build does not use split images
Returns image name for current environment.
arg1: package name
Function will be called when 'source' build is requested. As arg1 package name is set (eg. pe-nodejs).
arg1: package name
Same as for run_source
, but for package 'build' stage.
arg1: package name
Optional, run_source
is set as default. Same as for 'source', but called for source build of dependency package.
arg1: package name
Optional, run_build
is set as default. Same as for run_source_deps
but for 'build' stage.
arg1: package name
Build metapackage function. It should run proper script to build requested package
Run tar archive build
arg1: package name
Function is called when arg1 package should be deployed to internal package repository.
arg1: package name
Print path to build.sh script relative to repository root.
Function which will be called just before running docker create or docker run commands. Used to set proper PLATFORM_ARCH
.
Arrays to list packages supported in current environment. PACKAGES
array is mandatory.
The opt_*_arch
variables are set as array from value passed in --arch
param. All has initially same value as arg_arch
variable. env_load
can modify them to enable different architectures for different stages - for example on cross-compiled environments only host architecture is needed for dependencies, not all listed in --arch
. If --arch
is not set host architecture is used.
opt_build_arch
- array of architecture names used for build and source stages for regular packages.opt_meta_arch
- arrays of architecture names used to build metapackages. Usually host architecture should be used.opt_deps_arch
- array of architecture names for dependency build. On cross-compilation enabled environments host arch should be set. On emulated - target architecture.
arg1: build
or source
arg2-N: run command and its arguments
Run command in temporary docker container.
arg1: Dockerfile
arg2: image type: build
or source
(to resolve image name)
ENV:
CTX_PATH
- build context root directory, default: ENV_TARGET_ROOT, or Dockerfile directory if ENV_TARGET_ROOT was not setENV_TARGET_ROOT
- build context if CTX_PATH is not setPELION_DOCKER_PREFIX
- prefix to image name (passed as PREFIX arg to the build instance)DOCKER_BUILD_ARGS
- list additional build arguments (will prepend--build-arg
on each element)PLATFORM_ARCH
---platform=$PLATFORM_ARCH
passed to docker if set (optional, default: no--platform
arg)
NOTE: --pull flag required to workaround multiarch issue
Dockerfile arguments provided by this function (--build-arg
):
USER_ID
GROUP_ID
PREFIX
Build docker images using Dockerfile
arg1-N: command to run with its arguments
Run command in docker container (temporary or reused) or natively if --docker
is not set.
If docker image is missing it will be created.