Fix Docker build failure: add git to builder stage (#960)

The Docker browser build fails because yarn cannot install
`@electron/node-gyp` from GitHub without git.

## Changes

- Add git to builder stage in `Dockerfile.browser`
- Git is excluded from final production image via multi-stage build

## Technical Details

The `yarn.lock` contains a git-based dependency:
```
"@electron/node-gyp@https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2"
```

Alpine Linux base image lacks git by default. Installing it only in the
builder stage (where `yarn install` runs) resolves the build failure
without affecting production image size.

<!-- START COPILOT CODING AGENT SUFFIX -->



<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> fix
https://github.com/thomasnordquist/MQTT-Explorer/actions/runs/20442696351/job/58739200179


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-22 21:38:04 +01:00
committed by GitHub
parent 2c147a92ad
commit 85475a9201

View File

@@ -4,6 +4,9 @@ FROM node:24-alpine AS builder
WORKDIR /build 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 files for dependency installation
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
COPY app/package.json ./app/ COPY app/package.json ./app/