Richard Henderson <richard.hender...@linaro.org> writes:
> On 10/12/21 10:03 AM, Alex Bennée wrote: >> We need^H^H^H^H (might need, see bellow) a separate patch with: >> docker-image-debian10: NOUSER=1 >> to ensure the images we base our "handbuilt" compilers on don't >> include >> a potentially clashing uid (which should only be added for local >> builds). > > I think we ought to push this further back into docker.py. > > I think that we should always have a separate image without the user > installed. When asking for a build with user installed, copy the > nouser image (perhaps cached) and simply add the user. > >> We need to split this like in hexagon and have a second stage which does >> a: >> COPY --from=0 /usr/local /usr/local >> This will limit the size of the final image (and also avoid >> duplicting >> the UID in the hexagon build). > > What are we eliminating from the image with the second FROM, since we > then go back and add in all the build-dep for qemu. > > There are one or two extra packages required for building gcc itself > (e.g. libmpc) but they're not large. Where does the major savings > come from? Hmm that is curious: $ docker history registry.gitlab.com/qemu-project/qemu/qemu/debian-nios2-cross:latest ... <missing> 2 weeks ago RUN /bin/sh -c id rth 2>/dev/null || useradd… 330kB buildkit.dockerfile.v0 <missing> 2 weeks ago LABEL com.qemu./home/rth/qemu/git-alt/tests/… 0B buildkit.dockerfile.v0 <missing> 2 weeks ago LABEL com.qemu.dockerfile-checksum=fc3e779ae… 0B buildkit.dockerfile.v0 <missing> 2 weeks ago ENV PATH=/usr/local/sbin:/usr/local/bin:/usr… 0B buildkit.dockerfile.v0 <missing> 2 weeks ago RUN /bin/sh -c cd /root && ./build-toolchain… 973MB buildkit.dockerfile.v0 <missing> 2 weeks ago ADD build-toolchain.sh /root/build-toolchain… 2.14kB buildkit.dockerfile.v0 <missing> 2 weeks ago RUN /bin/sh -c apt update && DEBIAN_FRON… 17.3MB buildkit.dockerfile.v0 <missing> 2 weeks ago /bin/sh -c #(nop) LABEL com.qemu.dockerfile… 0B <missing> 2 weeks ago /bin/sh -c apt update && DEBIAN_FRONTEND… 715MB <missing> 2 weeks ago /bin/sh -c cat /etc/apt/sources.list | sed "… 854B <missing> 2 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) ADD file:99db7cfe7952a1c7a… 69.2MB yet with the split build: $ docker image history qemu/debian-nios2-cross:latest IMAGE CREATED CREATED BY SIZE COMMENT 24fbdeba931c 4 hours ago LABEL com.qemu./home/alex.bennee/lsrc/qemu.g… 0B buildkit.dockerfile.v0 <missing> 4 hours ago LABEL com.qemu.dockerfile-checksum=e7d3631e6… 0B buildkit.dockerfile.v0 <missing> 4 hours ago ENV PATH=/usr/local/sbin:/usr/local/bin:/usr… 0B buildkit.dockerfile.v0 <missing> 4 hours ago COPY /usr/local /usr/local # buildkit 1.77GB buildkit.dockerfile.v0 <missing> 4 hours ago RUN /bin/sh -c apt update && DEBIAN_FRON… 781MB buildkit.dockerfile.v0 <missing> 4 hours ago RUN /bin/sh -c cat /etc/apt/sources.list | s… 854B buildkit.dockerfile.v0 <missing> 7 months ago /bin/sh -c #(nop) CMD ["bash"] 0B <missing> 7 months ago /bin/sh -c #(nop) ADD file:3c32f1cd03198e141… 69.2MB which makes it look like the artefacts are bigger than the whole build. -- Alex Bennée