From 308b748d0ed5bb09700559d7e5e5b190d48a3918 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 22:02:18 +0100 Subject: [PATCH] Remove git dependency from Docker build via yarn resolution (#961) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker browser build fails because `@electron/rebuild` requires `@electron/node-gyp` from a GitHub URL, which needs git to clone. The package exists on npm registry but yarn.lock referenced the git URL. ## Changes - **Added yarn resolution** to force `@electron/node-gyp@10.2.0-electron.1` from npm registry instead of GitHub - **Removed git installation** from Dockerfile.browser builder stage - **Updated yarn.lock** to resolve dependency from `registry.yarnpkg.com` instead of `github.com` ```diff // package.json + "resolutions": { + "@electron/node-gyp": "10.2.0-electron.1" + } ``` ```diff // Dockerfile.browser - RUN apk add --no-cache git ``` This eliminates the git dependency entirely while preserving the exact same package version.
Original prompt > build still fails https://github.com/thomasnordquist/MQTT-Explorer/actions/runs/20443384267/job/58741359390
--- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com> --- Dockerfile.browser | 3 --- package.json | 3 +++ yarn.lock | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile.browser b/Dockerfile.browser index 94fcc2e..72fe762 100644 --- a/Dockerfile.browser +++ b/Dockerfile.browser @@ -4,9 +4,6 @@ FROM node:24-alpine AS builder WORKDIR /build -# Install git (required for git-based dependencies like @electron/node-gyp) -RUN apk add --no-cache git - # Copy package files for dependency installation COPY package.json yarn.lock ./ COPY app/package.json ./app/ diff --git a/package.json b/package.json index bacf9d2..36a44e2 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,9 @@ "type": "git", "url": "https://github.com/thomasnordquist/MQTT-Explorer.git" }, + "resolutions": { + "@electron/node-gyp": "10.2.0-electron.1" + }, "build": { "appId": "mqtt-explorer", "productName": "MQTT Explorer", diff --git a/yarn.lock b/yarn.lock index 8234bbd..cded6d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -667,9 +667,10 @@ optionalDependencies: global-agent "^3.0.0" -"@electron/node-gyp@https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2": +"@electron/node-gyp@10.2.0-electron.1", "@electron/node-gyp@https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2": version "10.2.0-electron.1" - resolved "https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2" + resolved "https://registry.yarnpkg.com/@electron/node-gyp/-/node-gyp-10.2.0-electron.1.tgz#ca5f125dcd0ffb275797c0c418c0d64005e0f815" + integrity sha512-YdpRE6qSNYyf7gBv1LBDc8OAs8f/mZthzM1k4pFzodNq8dBGf64MWC5Bq8VVlgdafjQXLpINHvtRAUC9uinoqw== dependencies: env-paths "^2.2.0" exponential-backoff "^3.1.1"