linuxdockerrustrustup

How can I reduce the size of rustup install?


I have this Dockerfile which builds my Neovim setup inside an Arch Linux container. Following logs show the amount of space each layer takes. The command rustup install nightly took 1.05GB of space which sounds unusual to me. Is there any way to reduce the amount of space taken my Rust nightly?

$ docker history s1n7ax/neovim:latest
IMAGE          CREATED       CREATED BY                                      SIZE      COMMENT
de4cac3f0fe9   7 hours ago   /bin/sh -c #(nop) WORKDIR /root                 0B
92121272827c   7 hours ago   /bin/sh -c nvim     --headless     -c 'set c…   692MB
8779585b1604   7 hours ago   /bin/sh -c nvim     --headless     -c 'autoc…   82.3MB
1b0cf08fadcf   7 hours ago   /bin/sh -c sed -i "s/max_jobs *= *[0-9]\+,*/…   12.4kB
26ee8d4eb0e6   7 hours ago   /bin/sh -c cp server/*.jar ~/.local/share/nv…   2.1MB
e0ea809b07bd   7 hours ago   /bin/sh -c yarn build-plugin                    145MB
cd66bd36b04c   7 hours ago   /bin/sh -c yarn                                 320MB
e6ed455333a2   7 hours ago   /bin/sh -c #(nop) WORKDIR /vscode-java-test     0B
881aece35a57   7 hours ago   /bin/sh -c cp     com.microsoft.java.debug.p…   2.86MB
01817765eefa   7 hours ago   /bin/sh -c ./mvnw clean install                 160MB
0496aff9c7e9   7 hours ago   /bin/sh -c chmod u+x mvnw                       0B
5675cbc79777   7 hours ago   /bin/sh -c #(nop) WORKDIR /java-debug           0B
a27056432eb9   7 hours ago   /bin/sh -c git clone https://github.com/micr…   12.4MB
947e120c0d95   7 hours ago   /bin/sh -c git clone https://github.com/micr…   2.83MB
a30656b6fa58   7 hours ago   /bin/sh -c mkdir -p ~/.local/share/nvim/lsp_…   0B
21699318e786   7 hours ago   /bin/sh -c #(nop) WORKDIR /                     0B
42ce1c7cdea4   7 hours ago   /bin/sh -c git clone --recurse-submodules -j…   2.45MB
478422a36727   7 hours ago   /bin/sh -c ln -s /usr/local/bin/nvim /usr/sb…   0B
6eb281356e67   7 hours ago   /bin/sh -c make install                         34.6MB
7b685c7218a0   7 hours ago   /bin/sh -c make CMAKE_BUILD_TYPE=Release        329MB
ca9dbcc78168   7 hours ago   /bin/sh -c #(nop) WORKDIR /neovim               0B
b3d8d34a8377   7 hours ago   /bin/sh -c git clone https://github.com/neov…   253MB
e1d162cf132c   7 hours ago   /bin/sh -c #(nop)  ENV PATH=~/.yarn/bin:~/.c…   0B
a7ba8d0af37f   7 hours ago   /bin/sh -c #(nop)  ENV PATH=~/.cargo/bin:~/.…   0B
22a3b31751f9   7 hours ago   /bin/sh -c #(nop)  ENV PATH=~/.local/bin:/us…   0B
33649aec725c   7 hours ago   /bin/sh -c #(nop)  ENV SHELL=/bin/bash          0B
9e8b31edbbde   7 hours ago   /bin/sh -c cargo install taplo-cli              106MB
7b45e6a9f648   7 hours ago   /bin/sh -c cargo install stylua                 110MB
92e12231c110   7 hours ago   /bin/sh -c pip install --upgrade autopep8       728kB
45ad80c3b346   7 hours ago   /bin/sh -c yarn global add prettier             38.1MB
83072229ae66   7 hours ago   /bin/sh -c rustup default nightly               103B
2d24ac105fec   7 hours ago   /bin/sh -c rustup install nightly               1.05GB
c93fbc7c84ca   7 hours ago   /bin/sh -c pacman -S --needed --noconfirm   …   1.12GB
38f82d2a27d2   7 hours ago   /bin/sh -c pacman -Syu --noconfirm              35MB
ec4c97123c01   4 days ago    /bin/sh -c #(nop)  CMD ["/usr/bin/bash"]        0B
<missing>      4 days ago    /bin/sh -c #(nop)  ENV LANG=C.UTF-8             0B
<missing>      4 days ago    /bin/sh -c ldconfig &&     sed -i '/BUILD_ID…   32.3kB
<missing>      4 days ago    /bin/sh -c #(nop) COPY dir:f054defad7465e3fc…   396MB

Solution

  • rustup install --profile=minimal nightly reduce the space by almost half. I can see, minimal has no docs included.