diff --git a/generate.pl b/generate.pl index 27c83b18..1a599dae 100755 --- a/generate.pl +++ b/generate.pl @@ -64,8 +64,7 @@ sub die_with_sample { savedPackages="make netbase" \ && apt-mark auto '.*' > /dev/null \ && apt-mark manual $savedPackages \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -fr /var/cache/apt/* /var/lib/apt/lists/* + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false EOF chomp $docker_slim_run_purge; @@ -89,6 +88,13 @@ sub die_with_sample { sha256 => "9b60767fe40752ef7a9d3f13f19060a63389a5c23acc3e9827e19b75500f81f3", ); +# sha256 taken from http://cdn-fastly.deb.debian.org/debian/pool/main/t/tini/tini_0.18.0-1.dsc +my %tini = ( + name => "tini-0.18.0", + url => "https://github.com/krallin/tini/archive/v0.18.0.tar.gz", + sha256 => "1097675352d6317b547e73f9dc7c6839fd0bb0d96dafc2e5c95506bb324049a2", +); + die_with_sample unless defined $config->{releases}; die_with_sample unless ref $config->{releases} eq "ARRAY"; @@ -141,6 +147,7 @@ sub die_with_sample { for my $build (keys %builds) { $release->{url} = $url; $release->{"cpanm_dist_$_"} = $cpanm{$_} for keys %cpanm; + $release->{"tini_dist_$_"} = $tini{$_} for keys %tini; $release->{extra_flags} ||= ''; $release->{debian_release} ||= ['buster']; @@ -155,7 +162,9 @@ sub die_with_sample { my $output = $template; $output =~ s/\{\{$_\}\}/$release->{$_}/mg - for (qw(version pause extra_flags sha256 type url image cpanm_dist_name cpanm_dist_url cpanm_dist_sha256)); + for ( + qw(version pause extra_flags sha256 type url image cpanm_dist_name cpanm_dist_url cpanm_dist_sha256 tini_dist_name tini_dist_url tini_dist_sha256) + ); $output =~ s/\{\{args\}\}/$builds{$build}/mg; if ($build =~ /slim/) { @@ -293,12 +302,24 @@ =head1 DESCRIPTION && {{test}} \ && make install \ && cd /usr/src \ + && apt-get update \ + && apt-get install -y --no-install-recommends cmake \ + && curl -L {{tini_dist_url}} -o {{tini_dist_name}}.tar.gz \ + && echo '{{tini_dist_sha256}} *{{tini_dist_name}}.tar.gz' | sha256sum -c - \ + && tar -xzf {{tini_dist_name}}.tar.gz && cd {{tini_dist_name}} \ + && CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37" \ + && cmake . && make && make install \ + && cd /usr/src \ && curl -LO {{cpanm_dist_url}} \ && echo '{{cpanm_dist_sha256}} *{{cpanm_dist_name}}.tar.gz' | sha256sum -c - \ && tar -xzf {{cpanm_dist_name}}.tar.gz && cd {{cpanm_dist_name}} && perl bin/cpanm . && cd /root \ && {{docker_slim_run_purge}} \ + && apt-get purge -y --auto-remove cmake \ + && rm -fr /var/cache/apt/* /var/lib/apt/lists/* \ + && rm -fr /usr/src/{{tini_dist_name}}* \ && rm -fr ./cpanm /root/.cpanm /usr/src/perl /usr/src/{{cpanm_dist_name}}* /tmp/* WORKDIR / +ENTRYPOINT ["tini","--"] CMD ["perl{{version}}","-de0"]