docker: Fix missing CLN version in docker image
What changed, and why it matters
This commit fixes a build issue where Core Lightning Docker images were missing their version label. It changes how the VERSION value is passed from GitHub Actions into the Docker build and how the Makefile accepts an externally provided version. There is no security problem here—just a packaging/metadata fix.
No security action needed. This is a routine build-fix commit. Reviewers may verify Docker images now report the correct version string.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch ensures the CLN version string is correctly propagated into Docker builds. It adds fetch-depth: 0 to the GitHub Actions checkout so git tags are available, passes VERSION as a Docker build argument, exposes it as an environment variable in the Dockerfile, and changes the Makefile to use ?= so an externally supplied VERSION is preferred over running git describe. It also updates .dockerignore and .gitignore to exclude additional build/tooling directories.
Changed components
Docker image build pipelineGitHub Actions docker-release workflowDockerfileMakefile version detectionInspect captured patch +18 / −5
diff --git a/.dockerignore b/.dockerignore
index 955f81af..4be4454f 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,6 +1,10 @@
-Dockerfile
-contrib/docker/Dockerfile.*
-target
config.vars
+.cargo/
+.vscode/
+.venv/
+dist/
+target/
release/
-.venv/
\ No newline at end of file
+focal/
+jammy/
+noble/
diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
index 635c3979..64a64995 100644
--- a/.github/workflows/docker-release.yml
+++ b/.github/workflows/docker-release.yml
@@ -36,6 +36,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.ref }} # Ensures the branch triggering the workflow is checked out
+ fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -116,3 +117,5 @@ jobs:
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.TAGS }}
+ build-args: |
+ VERSION=${{ env.VERSION }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index d8ba3ca5..d90ccc95 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ plugins/clnrest
plugins/wss-proxy
plugins/cln-bip353
.clangd
+.cargo/
# Build directories
bionic/
diff --git a/Dockerfile b/Dockerfile
index 63a923ed..3bb55054 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -125,6 +125,8 @@ ARG LD=${target_arch}-ld
ARG STRIP=${target_arch}-strip
ARG TARGET=${target_arch_rust}
ARG RUST_PROFILE=release
+ARG VERSION
+ENV VERSION=${VERSION}
#TODO: set all the following cargo config options via env variables (https://doc.rust-lang.org/cargo/reference/environment-variables.html)
RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF
diff --git a/Makefile b/Makefile
index e9958673..54a3bbea 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,10 @@
#! /usr/bin/make
+# Prefer VERSION from environment if provided (e.g., from GitHub Actions)
# Extract version from git, or if we're from a zipfile, use dirname
-VERSION=$(shell git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | $(SED) -n 's|.*/c\{0,1\}lightning-v\{0,1\}\([0-9a-f.rc\-]*\)$$|v\1|gp')
+VERSION ?= $(shell git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || \
+ pwd | sed -n 's|.*/c\{0,1\}lightning-v\{0,1\}\([0-9a-f.rc\-]*\)$$|v\1|gp')
+$(info Building version $(VERSION))
# Next release.
CLN_NEXT_VERSION := v25.12
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.