Self-hosted Containers
Opinionated Docker Image and Container Management
CDAF 2.6.1 & 2.6.2
With the progressive introduction of image and container management to CDAF, there has been a level of inconsistency around how the process operates.
The primary use case for CDAF containers is for self-hosted agents/runners to provide a similar capability to container native orchestration tools, e.g. GitLab and BitBucket Pipelines.
The following is a summary of the supported processes.
containerBuild
Used to perform the build prcess within a container. This is executed using a volume mount, so that the resulting artefacts are retained once the container closes. The user home directory is also mounted to provide shared cache data, for example, Maven dependencies. Additional build configuration can be supplied via environment variables CDAF_CB_
, see CDAF Environment Variables.
imageBuild
Produce an immutable image based on the build artefacts, with an optional registry push configuration.
containerDeploy
Execute the deployment task within a container. This container is not volume mounted, instead the delivery process is injected into the image and executed at runtime. The management of environment specific configuration is via environment variables CDAF_CD_
, see CDAF Environment Variables.
Linux Considerations
containerBuild and imageBuild will configure the host user as the default runtime user in the image. If the base image defined already contains a user with the same UID, that user will be removed and replaced.
Minimum Configuration
Along with the consistent implementation of default processes, default Dockerfiles are also defined, resulting in the following minimal CDAF.solution
configuration for containerBuild
, imageBuild
and containerDeploy
respectively.
containerImage=cdaf/linux
buildImage=cdaf/linux
runtimeImage=cdaf/linux
For image build, the release environment for image construction is IMMUTABLE
, i.e. an example properties.cm
file could be…
context target deployTaskOverride
local IMMUTABLE immutable.tsk
For full release details for CDAF 2.6.2 see http://cdaf.io/release