build: fix regression: support local dev builds also using UID!=1000
What changed, and why it matters
This commit fixes a build-script bug that prevented developers whose Linux user ID is not 1000 from running Electrum's Docker-based build scripts. It does not change any wallet, network, or cryptographic code, and it does not create a security vulnerability.
No security action needed; treat as a normal build-system fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change replaces a hard-coded UID 1000 in four Dockerfiles with a build-time ARG defaulting to 1000. This lets the build scripts pass the host user’s UID into the container so file ownership and git operations work for local development builds. The sudo/nopasswd configuration already existed before this commit and is unchanged.
Changed components
contrib/android/Dockerfilecontrib/build-linux/appimage/Dockerfilecontrib/build-linux/sdist/Dockerfilecontrib/build-wine/DockerfileInspect captured patch +8 / −8
diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile
index be455d1..70a6ad7 100644
--- a/contrib/android/Dockerfile
+++ b/contrib/android/Dockerfile
@@ -196,8 +196,8 @@ RUN apt -y update -qq \
# create new user to avoid using root; but with sudo access and no password for convenience.
-# NOTE: UID *MUST* align with buildozer's Dockerfile "user"
-RUN useradd -u 1000 -m -s /usr/bin/bash -d /home/user user
+ARG UID=1000
+RUN useradd -u "$UID" -m -s /usr/bin/bash -d /home/user user
RUN usermod -aG sudo user
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV HOME_DIR=/home/user
diff --git a/contrib/build-linux/appimage/Dockerfile b/contrib/build-linux/appimage/Dockerfile
index a20cebb..0d55e23 100644
--- a/contrib/build-linux/appimage/Dockerfile
+++ b/contrib/build-linux/appimage/Dockerfile
@@ -74,8 +74,8 @@ RUN apt-get update -q && \
apt-get clean
# create new user to avoid using root; but with sudo access and no password for convenience.
-# NOTE: UID *MUST* align with buildozer's Dockerfile "user"
-RUN useradd -u 1000 -m -s /usr/bin/bash -d /home/user user
+ARG UID=1000
+RUN useradd -u "$UID" -m -s /usr/bin/bash -d /home/user user
RUN usermod -aG sudo user
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV HOME_DIR=/home/user
diff --git a/contrib/build-linux/sdist/Dockerfile b/contrib/build-linux/sdist/Dockerfile
index 4320eb5..4c284e4 100644
--- a/contrib/build-linux/sdist/Dockerfile
+++ b/contrib/build-linux/sdist/Dockerfile
@@ -17,8 +17,8 @@ RUN apt-get update -q && \
apt-get clean
# create new user to avoid using root; but with sudo access and no password for convenience.
-# NOTE: UID *MUST* align with buildozer's Dockerfile "user"
-RUN useradd -u 1000 -m -s /usr/bin/bash -d /home/user user
+ARG UID=1000
+RUN useradd -u "$UID" -m -s /usr/bin/bash -d /home/user user
RUN usermod -aG sudo user
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV HOME_DIR=/home/user
diff --git a/contrib/build-wine/Dockerfile b/contrib/build-wine/Dockerfile
index 62d2ccd..319b127 100644
--- a/contrib/build-wine/Dockerfile
+++ b/contrib/build-wine/Dockerfile
@@ -57,8 +57,8 @@ RUN DEBIAN_CODENAME=$(lsb_release --codename --short) && \
apt-get clean
# create new user to avoid using root; but with sudo access and no password for convenience.
-# NOTE: UID *MUST* align with buildozer's Dockerfile "user"
-RUN useradd -u 1000 -m -s /usr/bin/bash -d /home/user user
+ARG UID=1000
+RUN useradd -u "$UID" -m -s /usr/bin/bash -d /home/user user
RUN usermod -aG sudo user
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV HOME_DIR=/home/user
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.