<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Le 02/09/2024 à 13:52, Marc a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:294b08308e4b464986ccbf291540465d@f1-outsourcing.eu">
<pre class="moz-quote-pre" wrap="">1.
Afaik you don't need to remove packages from builder, the whole builder layer will be gone.
</pre>
</blockquote>
I did that to avoid copy extra files with the COPY --from=builder
command<br>
<blockquote type="cite"
cite="mid:294b08308e4b464986ccbf291540465d@f1-outsourcing.eu">
<pre class="moz-quote-pre" wrap="">
2.
COPY --from=builder /usr/ /usr/
I think this will copy duplicates, duplicates increase still layer size so you have 2x size of a default /usr
so you can only copy individual files</pre>
</blockquote>
<p>You are right, extra files appear in the diff! I was thinking
that the files already present would be discarded. Copying
individual files in this case is not the solution: there are
plenty of files (305 if counting includes)<span
style="white-space: pre-wrap"></span></p>
<p><span style="white-space: pre-wrap">So this is a bit more complicated to achieve something cleaner. Maybe install the binaries in an alternate directory in the build step?</span></p>
<p><span style="white-space: pre-wrap">I made a new Dockerfile based on this idea, now the result is 66MB. I tested the build, but not if it is still functional (see all expected files in the right place).
</span></p>
<p><span style="white-space: pre-wrap">
</span></p>
<blockquote type="cite"
cite="mid:294b08308e4b464986ccbf291540465d@f1-outsourcing.eu">
<pre class="moz-quote-pre" wrap="">
"As long as there is a COPY in your Dockerfile, the size of the image increases to the stuff you copy"
* don't really know if this is still accurate
That could explain your big image.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">-----Original Message-----
From: bind-users <a class="moz-txt-link-rfc2396E" href="mailto:bind-users-bounces@lists.isc.org"><bind-users-bounces@lists.isc.org></a> On Behalf Of Devpt
Calmarsoft
Sent: Monday, 2 September 2024 12:25
To: <a class="moz-txt-link-abbreviated" href="mailto:bind-users@lists.isc.org">bind-users@lists.isc.org</a>
Subject: Re: Updated Docker images (9.18, 9.20, 9.21) - now based on
Alpine Linux
I forgot to specify the runtime dependency packages (fixed Dockerfile
attached), I am sorry.
This is still minimal changes, and the result is now 101MB, which is
still an interesting improvement (371MB before changes). Note that when
building, the intermediate image is visible.
Le 02/09/2024 à 11:23, Devpt Calmarsoft a écrit :
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Le 27/08/2024 à 19:52, Ondřej Surý a écrit :
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">What’s the size difference for you?
I mean if someone wants to play with our Dockerfile and there’s a
significant reduction is size, I would be convinced. But in a world,
where a mobile application that does absolutely nothing has 4 GB, I
feel like 130 MB is on the low side of the scale.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">There is a way to forget the compilation steps, using the "--from"
option of COPY, see here:
<a class="moz-txt-link-freetext" href="https://docs.docker.com/reference/dockerfile/#copy---from">https://docs.docker.com/reference/dockerfile/#copy---from</a>
=>
I made the experiment, and the image drops to 63MB instead of
243MB (without keeping the sources).
remarks:
I chose to clone only the /usr because that path seem to be
the only one affected during the build/install.
I duplicated the LC_ALL env variable, as I don't know if it is
needed for runtime or build phase.
In my opinion this would be cleaner that way (with drawback that we
cannot see the build steps history anymore)
Benoit
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Ondrej
--
Ondřej Surý — ISC (He/Him)
My working hours and your working hours may be different. Please do
not feel obligated to reply outside your normal working hours.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On 27. 8. 2024, at 19:38, Peter DeVries <a class="moz-txt-link-rfc2396E" href="mailto:pdevries@quotient-inc.com"><pdevries@quotient-inc.com></a>
wrote:
For what it's worth this is how we build our dockers, with a builder
and then the runner. IMO it's cleaner that way and not much more
complicated. We'll continue to roll our own though so no real dog in
this fight.
Peter
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Tue, Aug 27, 2024 at 1:28 PM Ondřej Surý <a class="moz-txt-link-rfc2396E" href="mailto:ondrej@isc.org"><ondrej@isc.org></a> wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On 27. 8. 2024, at 18:57, Marc <a class="moz-txt-link-rfc2396E" href="mailto:Marc@f1-outsourcing.eu"><Marc@f1-outsourcing.eu></a> wrote:
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Afaik apk del \ does not free up space still.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Right. That was not really my intention though. I wanted to reduce
the amount of cruft installed in the image. The less binary stuff
around, the less possible attack surface.
But apk --no-cache should work I guess.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">If you work with builder phase, you can probably shave of some MB's
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I think that's too complicated to use two phases, but I think the
next update
should reduce the image size a little bit. It was ~170 MB before
and the
reduced (compressed) size is 130 MB.
But I get it - the base alpine:latest is only 3 MB, that's quite a
difference.
Ondrej
--
Ondřej Surý (He/Him)
<a class="moz-txt-link-abbreviated" href="mailto:ondrej@isc.org">ondrej@isc.org</a>
My working hours and your working hours may be different. Please do
not feel obligated to reply outside your normal working hours.
--
Visit <a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/bind-users">https://lists.isc.org/mailman/listinfo/bind-users</a> to
unsubscribe from this list
ISC funds the development of this software with paid support
subscriptions. Contact us at <a class="moz-txt-link-freetext" href="https://www.isc.org/contact/">https://www.isc.org/contact/</a> for more
information.
bind-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:bind-users@lists.isc.org">bind-users@lists.isc.org</a>
<a class="moz-txt-link-freetext" href="https://lists.isc.org/mailman/listinfo/bind-users">https://lists.isc.org/mailman/listinfo/bind-users</a>
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</blockquote>
</blockquote>
<p><br>
</p>
</body>
</html>