NAME

Container::Buildah::Stage - object used by Container::Buildah to track a stage of a multi-stage container build

VERSION

version 0.3.1

SYNOPSIS

# Container::Buildah:Stage objects are created only by Container::Buildah
# It passes a separate instance to each stage function
sub stage_runtime
{
	my $stage = shift;
	$stage->run( [qw(/sbin/apk --update upgrade)] );
	$stage->add( { dest => "/opt/swpkg" }, "tarball.tar.xz" );
	$stage->config({
		env => ["SWPKG_LOG=-g"],
		volume => [qw(/var/cache/swpkg)],
		port => ["8881"],
		entrypoint => "/opt/swpkg/entrypoint.sh",
	});
}

DESCRIPTION

Container::Buildah:Stage objects are created and used by Container::Buildah. These are passed to the callback function for each build-stage container.

The class contains methods which are wrappers for the buildah subcommands that require a container name parameter on the command line. However, the container name is within the object. So it is not passed as a separate parameter to these methods.

Each instance contains the configuration information for that stage of the build.

Container::Buildah::Stage automatically adds the --add-history option so that each action will be recorded as part of the OCI container build history.

METHODS

new

instantiates a Container::Buildah:Stage object. This method is private and may only be called by Container::Buildah.

status

prints a list of strings to STDOUT

debug

Prints a list of strings to STDERR, if debugging is at the specified level. This is a wrapper around the Container::Buildah::debug() method, which adds a label parameter with the container name.

container_name

add

commit

config

copy

run ( {option => value, ...}, [command, arg, ...] | [[command, arg, ...], ...] )

The option parameter is a hash reference with command-line options for buildah-run. For options with shortcut aliases, only the long form is recognized here in order to avoid duplication.

The command parameter can be an array of strings for one command, or array of arrays of strings for multiple commands. This applies the same command-line arguments to each command it runs.

FUNCTIONS

stage_config

BUGS AND LIMITATIONS

Please report bugs via GitHub at https://github.com/ikluft/Container-Buildah/issues

Patches and enhancements may be submitted via a pull request at https://github.com/ikluft/Container-Buildah/pulls

Containers can only be run with a Linux kernel revision 2.8 or newer.

AUTHOR

Ian Kluft <https://github.com/ikluft>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Ian Kluft.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004