1.
Afaik you don't need to remove packages from builder, the whole builder layer 
will be gone.

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

"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.





> -----Original Message-----
> From: bind-users <bind-users-boun...@lists.isc.org> On Behalf Of Devpt
> Calmarsoft
> Sent: Monday, 2 September 2024 12:25
> To: bind-users@lists.isc.org
> 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 :
> > Le 27/08/2024 à 19:52, Ondřej Surý a écrit :
> >> 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.
> > There is a way to forget the compilation steps, using the "--from"
> > option of COPY, see here:
> > https://docs.docker.com/reference/dockerfile/#copy---from
> >
> > =>
> >     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
> >> 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.
> >>
> >>> On 27. 8. 2024, at 19:38, Peter DeVries <pdevr...@quotient-inc.com>
> >>> 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
> >>>
> >>>> On Tue, Aug 27, 2024 at 1:28 PM Ondřej Surý <ond...@isc.org> wrote:
> >>>>
> >>>>>> On 27. 8. 2024, at 18:57, Marc <m...@f1-outsourcing.eu> wrote:
> >>>>> Afaik apk del \ does not free up space still.
> >>>> 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.
> >>>>
> >>>>> If you work with builder phase, you can probably shave of some MB's
> >>>>
> >>>> 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)
> >>>> ond...@isc.org
> >>>>
> >>>> My working hours and your working hours may be different. Please do
> >>>> not feel obligated to reply outside your normal working hours.
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Visit https://lists.isc.org/mailman/listinfo/bind-users to
> >>>> unsubscribe from this list
> >>>>
> >>>> ISC funds the development of this software with paid support
> >>>> subscriptions. Contact us at https://www.isc.org/contact/ for more
> >>>> information.
> >>>>
> >>>>
> >>>> bind-users mailing list
> >>>> bind-users@lists.isc.org
> >>>> https://lists.isc.org/mailman/listinfo/bind-users
> >
> >
> >
> >
-- 
Visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from 
this list

ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.


bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to