fix(docker): fix build failures for UI, Go deps, and unzip

- Install unzip in Node builder for zip-format deps (BBDown, gopeed)
- Copy apps/electron/app/package.json needed by UI vite config
- Add second go mod download after full source copy to fix go.sum

Verified: docker build + run succeeds locally (healthy + player UI ok)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
caorushizi
2026-04-02 23:33:35 +08:00
parent 5d1dc7716f
commit 548ca9cd46
2 changed files with 8 additions and 4 deletions
+1 -2
View File
@@ -12,10 +12,9 @@
apps/core/bin/
apps/core/server
# Electron source (not needed, but keep package.json for workspace resolution)
# Electron source (not needed, but keep package.json files for workspace/build)
apps/electron/src/
apps/electron/scripts/
apps/electron/app/
docs/
# OS files
+7 -2
View File
@@ -4,6 +4,7 @@
# ===== Stage 1: Node Builder (runs natively on build machine) =====
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS node-builder
RUN apt-get update && apt-get install -y --no-install-recommends unzip && rm -rf /var/lib/apt/lists/*
RUN corepack enable && corepack prepare pnpm@10.15.0 --activate
# Map Docker TARGETARCH to Node arch naming for deps download
@@ -26,11 +27,12 @@ COPY apps/electron/package.json apps/electron/package.json
COPY packages/ packages/
RUN pnpm install --frozen-lockfile
# Copy source files
# Copy source files and root configs needed by builds
COPY tsconfig*.json turbo.json .env* ./
COPY apps/ui/ apps/ui/
COPY apps/player-ui/ apps/player-ui/
COPY apps/electron/app/package.json apps/electron/app/package.json
COPY scripts/ scripts/
COPY .env* turbo.json ./
# Build player-ui (will be embedded in Go core binary)
RUN pnpm --filter @mediago/player-ui run build
@@ -61,6 +63,9 @@ COPY apps/core/ apps/core/
# Copy player-ui dist into assets for go:embed
COPY --from=node-builder /src/apps/player-ui/dist apps/core/assets/player/
# Ensure all dependencies are downloaded (go.sum may have been updated)
RUN cd apps/core && go mod download
# Build Go core binary (cross-compile, no CGO)
RUN cd apps/core && \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \