Skip to content

docker: make local builds work without version arg#9135

Open
longbiaochen wants to merge 2 commits into
ElementsProject:masterfrom
longbiaochen:codex/m2-docker-version-default
Open

docker: make local builds work without version arg#9135
longbiaochen wants to merge 2 commits into
ElementsProject:masterfrom
longbiaochen:codex/m2-docker-version-default

Conversation

@longbiaochen
Copy link
Copy Markdown

@longbiaochen longbiaochen commented May 14, 2026

Fixes #7812

This makes the Dockerfile work for a plain local docker build . on Apple Silicon without requiring release-only build args.

Changes:

  • give the Docker VERSION build arg a non-empty default (master) so ENV VERSION does not override Makefile version generation with an empty value
  • add an optional MAKE_JOBS build arg while preserving the existing default nproc parallelism; low-memory local Docker VMs can pass --build-arg MAKE_JOBS=1

Verified on macOS Apple Silicon with Colima (linux/arm64 target, 8GB/4 CPU):

  • docker build --target builder --progress=plain .
  • docker build --progress=plain .

The original configurator failure no longer occurs on current master, but a plain Docker build currently fails later because empty VERSION prevents version_gen.h generation. With this patch the full default Docker image builds successfully.

Copilot AI review requested due to automatic review settings May 14, 2026 15:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the root Dockerfile to make docker build . succeed in local environments (notably Apple Silicon) without requiring release-only build arguments, by ensuring a non-empty VERSION and limiting parallelism by default.

Changes:

  • Set a non-empty default for Docker build arg VERSION (master) to avoid overriding Makefile version derivation with an empty value.
  • Add MAKE_JOBS build arg (default 1) and use it for make -j... in the builder stage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile Outdated
Comment on lines 127 to 129
ARG VERSION=master
ARG MAKE_JOBS=1
ENV VERSION=${VERSION}
Comment thread Dockerfile Outdated

RUN ./configure --prefix=/tmp/lightning_install --enable-static --disable-compat --disable-valgrind
RUN uv run make install-program -j$(nproc)
RUN uv run make install-program -j${MAKE_JOBS}
@longbiaochen longbiaochen force-pushed the codex/m2-docker-version-default branch from 1f900c1 to ae9add8 Compare May 14, 2026 16:12
@longbiaochen
Copy link
Copy Markdown
Author

Updated after initial submission: MAKE_JOBS is now optional and defaults to the existing nproc behavior via ${MAKE_JOBS:-$(nproc)}. The only default behavior change is the non-empty VERSION=master build arg, which prevents an empty ENV VERSION from blocking version_gen.h generation during plain local Docker builds.

Re-verified after the update:

  • docker build --target builder --progress=plain .
  • docker build --progress=plain .

@longbiaochen
Copy link
Copy Markdown
Author

Updated to address the Dockerfile review feedback. The builder no longer sets a global default VERSION/ENV; when VERSION is omitted, the Makefile derives the version from git, and VERSION is only passed into make when explicitly provided. MAKE_JOBS remains optional and falls back to nproc when omitted.\n\nRe-verified after this update:\n- docker build --target builder --progress=plain .\n- docker build --progress=plain .\n\nI used a temporary Docker config for the local build because this machine's Docker config references a missing docker-credential-desktop helper; the image build itself completed on the colima builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to build Dockerfile on M2 OSX

2 participants