@@ -70,6 +70,13 @@ sub die_with_sample {
70
70
EOF
71
71
chomp $docker_slim_run_purge ;
72
72
73
+ my $docker_debug_run_install = <<'EOF' ;
74
+ apt-get update \
75
+ && apt-get install -y --no-install-recommends \
76
+ gdb
77
+ EOF
78
+ chomp $docker_debug_run_install ;
79
+
73
80
my $config = do {
74
81
open my $fh , ' <' , ' config.yml' or die " Couldn't open config" ;
75
82
local $/ ;
@@ -152,7 +159,9 @@ sub die_with_sample {
152
159
153
160
$release -> {extra_flags } ||= ' ' ;
154
161
155
- $release -> {image } = $build =~ / main/ ? ' buildpack-deps' : ' debian' ;
162
+ $release -> {image } = $build =~ / (main|debug)/ ? ' buildpack-deps' : ' debian' ;
163
+
164
+ my $debug_flags = $build =~ / debug/ ? ' -Doptimize=-g -DEBUGGING=both' : ' ' ;
156
165
157
166
for my $debian_release (@{$release -> {debian_release }}) {
158
167
@@ -162,16 +171,24 @@ sub die_with_sample {
162
171
$output =~ s /\{\{ args\}\} / $builds {$build }/ mg ;
163
172
164
173
if ($build =~ / slim/ ) {
165
- $output =~ s /\{\{ docker_slim_run_install \}\} / $docker_slim_run_install / mg ;
166
- $output =~ s /\{\{ docker_slim_run_purge \}\} / $docker_slim_run_purge / mg ;
174
+ $output =~ s /\{\{ docker_run_install \}\} / $docker_slim_run_install / mg ;
175
+ $output =~ s /\{\{ docker_run_purge \}\} / $docker_slim_run_purge / mg ;
167
176
$output =~ s /\{\{ tag\}\} / $debian_release -slim/ mg ;
168
177
}
178
+ elsif ($build =~ / debug/ ) {
179
+ $output =~ s /\{\{ docker_run_install\}\} / $docker_debug_run_install / mg ;
180
+ $output =~ s /\{\{ debug_flags\}\} / $debug_flags / mg ;
181
+ $output =~ s #\{\{ docker_run_purge\}\} # rm -fr /var/cache/apt/* /var/lib/apt/lists/*# mg ;
182
+ $output =~ s /\{\{ tag\}\} / $debian_release / mg ;
183
+ }
169
184
else {
170
- $output =~ s /\{\{ docker_slim_run_install \}\} / true/ mg ;
171
- $output =~ s /\{\{ docker_slim_run_purge \}\} / true/ mg ;
185
+ $output =~ s /\{\{ docker_run_install \}\} / true/ mg ;
186
+ $output =~ s /\{\{ docker_run_purge \}\} / true/ mg ;
172
187
$output =~ s /\{\{ tag\}\} / $debian_release / mg ;
173
188
}
174
189
190
+ $output =~ s / \{\{ debug_flags\}\} // mg ;
191
+
175
192
my $dir = sprintf " %i .%03i.%03i-%s -%s " , ($release -> {version } =~ / (\d +)\. (\d +)\. (\d +)/ ), $build , $debian_release ;
176
193
177
194
mkdir $dir unless -d $dir ;
@@ -292,7 +309,7 @@ =head1 DESCRIPTION
292
309
{{docker_copy_perl_patch}}
293
310
WORKDIR /usr/src/perl
294
311
295
- RUN {{docker_slim_run_install }} \
312
+ RUN {{docker_run_install }} \
296
313
&& curl -fL {{url}} -o perl-{{version}}.tar.{{type}} \
297
314
&& echo '{{sha256}} *perl-{{version}}.tar.{{type}}' | sha256sum --strict --check - \
298
315
&& tar --strip-components=1 -xaf perl-{{version}}.tar.{{type}} -C /usr/src/perl \
@@ -301,7 +318,7 @@ =head1 DESCRIPTION
301
318
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
302
319
&& archBits="$(dpkg-architecture --query DEB_BUILD_ARCH_BITS)" \
303
320
&& archFlag="$([ "$archBits" = '64' ] && echo '-Duse64bitall' || echo '-Duse64bitint')" \
304
- && ./Configure -Darchname="$gnuArch" "$archFlag" {{args}} {{extra_flags}} -des \
321
+ && ./Configure -Darchname="$gnuArch" "$archFlag" {{args}} {{extra_flags}} {{debug_flags}} -des \
305
322
&& make -j$(nproc) \
306
323
&& {{test}} \
307
324
&& make install \
@@ -314,7 +331,7 @@ =head1 DESCRIPTION
314
331
# sha256 checksum is from docker-perl team, cf https://github.com/docker-library/official-images/pull/12612#issuecomment-1158288299
315
332
&& echo '{{cpm_dist_sha256}} */usr/local/bin/cpm' | sha256sum --strict --check - \
316
333
&& chmod +x /usr/local/bin/cpm \
317
- && {{docker_slim_run_purge }} \
334
+ && {{docker_run_purge }} \
318
335
&& rm -fr /root/.cpanm /usr/src/perl /usr/src/{{cpanm_dist_name}}* /tmp/* \
319
336
&& cpanm --version && cpm --version
320
337
0 commit comments