Container-Buildah
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
examples/bind9/bind9-build.pl view on Meta::CPAN
#!/usr/bin/perl
# FILE: bind9-build.pl
# USAGE: ./bind9-build.pl
# ABSTRACT: example script for Container::Buildah which builds the current version of BIND9 for Alpine
# DESCRIPTION:
# ISC BIND9 container - custom APK build of current BIND9 so we don't have to depend on when Alpine releases
# an APK of the current version. This is a 2-stage build which makes the BIND9 APKs in the first stage, and
# uses the results of that in the runtime stage without keeping the compiler & build tools from the first stage.
# Note: this depend on updating the script to have the current BIND9 version number and sha512sum
# AUTHOR: Ian Kluft
# LICENSE: Apache License version 2
use strict;
use warnings;
use Modern::Perl qw(2018); # require security updates
use utf8;
use autodie;
use Readonly;
use Container::Buildah;
#
# configuration
#
# directory for build stage to make its APKs, not saved for other stages
Readonly::Scalar my $apkbuild_dir => "/opt/bind9-apkbuild";
# directory for build stage to save its APK product files, saved for runtime stage
Readonly::Scalar my $apk_dir => "/opt/bind9-apk";
# number of APKs which should be found (excluding unused dev, doc, openrc)
Readonly::Scalar my $apk_total => 7;
# container parameters
Container::Buildah::init_config(
basename => "bind9",
base_image => 'docker://docker.io/alpine:[% alpine_version %]',
required_config => [qw(alpine_version bind_version bind_src_sha512sum)],
stages => {
build => {
from => "[% base_image %]",
func_deps => \&do_deps,
func_exec => \&stage_build,
produces => [$apk_dir],
user => "named:named",
user_home => $apkbuild_dir,
},
runtime => {
from => "[% base_image %]",
consumes => [qw(build)],
func_deps => \&do_deps,
func_exec => \&stage_runtime,
user => "named:named",
user_home => "/home/bind9",
commit => ["[% basename %]:[% bind_version %]", "[% basename %]:latest"],
}
},
bind_src_file => "bind-[% bind_version %].tar.xz",
bind_apk_src => "https://git.alpinelinux.org/aports/plain/main/bind/?h=master",
);
# dependency installation function for both stages
sub do_deps
{
my $stage = shift;
$stage->run(
# install updates for APKs at this Alpine OS release level
[qw(/sbin/apk --no-cache update)],
# install shadow as a dependency for user/user_home configuration
# TODO add auto-dependency for configs based on Linux distro type (Alpine, Debian, Ubuntu, Fedora, CentOS/RHEL)
[qw(/sbin/apk add --no-cache shadow)],
);
view all matches for this distributionview release on metacpan - search on metacpan
( run in 3.384 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )