Skip to content

How to build reproducibly

Pin dependencies, lock tool versions, avoid timestamps in artifacts, and cache the deterministic parts.

A build you can trust

  1. Pin every dependency

    package-lock.json, composer.lock, go.sum, Gemfile.lock. A dependency on latest is a dependency on tomorrow's bug.

  2. Pin tool versions

    Node 20.10.0, PHP 8.2.15, Go 1.21.5. Not "the latest LTS". The latest LTS changes; your build should not.

  3. Avoid timestamps in output

    A build timestamp in the artifact makes two builds differ even when the source is identical. For build info, use git commit hash.

  4. Cache the deterministic parts

    Dependencies change less often than source. Cache node_modules or vendor between builds to cut build time by 80%.