Skip to content

[CI] Dockerfile enhancements: cloning #4022

@apostasie

Description

@apostasie

What is the problem you're trying to solve

Breakout of #4021.
Also see overall Dockerfile analysis for context.

Refresher:

  • we clone too much in size (full history), while we do not need it - github clones for a cold-cache run account for about 1G of content
  • we clone too often - we should only ever clone any given project once per run

Describe the solution you'd like

Suggesting that:

  1. we git clone --quiet (less noise on the logs)
  2. we git clone --depth 1 (reduce network traffic and cache size)
  3. we separate clone and build - one clone when building multi-arch, and use mounts for build to avoid unnecessary copies (reduce network traffic and cache size)

For reference, one way to do it:

Note that if we want to keep building using other projects build scripts, we would have to bind mounts RW (as most of these scripts do not allow to build out of tree). I personally believe we should build directly ourselves in most cases instead of relying on Makefiles / scripts (see #4021 for reasons).
If we do not want that, or not feasible in certain cases, we just need a simple lock to prevent cross-platforms builds from conflicting: https://github.com/farcloser/lepton/blob/main/Dockerfile#L753-L755

Let me know if that plan (1, 2, 3) is fine or if you prefer something else.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions