build(docker): pin base stage to $BUILDPLATFORM for cross-compilation#89
Merged
Conversation
Per the Docker multi-platform guide's cross-compilation section, pin the base/builder stage to the builder's native platform so the pnpm install and build steps never run under emulation, regardless of which runner strategy builds the image. The runner (final) stage is left unpinned so it always targets the actual build platform. Claude-Session: https://claude.ai/code/session_01Xv1EAagQkhuCRGY584Kuua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cosa cambia
Pinna lo stage
basedel Dockerfile a--platform=$BUILDPLATFORM, come indicato nella sezione cross-compilation della guida Docker: lo stage di build (pnpm install+pnpm run build+prisma:generate) gira sempre sull'architettura nativa del builder, mai sotto emulazione, indipendentemente dalla strategia di runner usata in CI. Lo stagerunner(finale) resta senza pin, quindi continua a targettare la piattaforma di build effettiva — dove infatti viene già rieseguitopnpm install --prod, che ricompila correttamente eventuali binding nativi per quella architettura.Con i runner Blacksmith nativi per-arch introdotti in wolfstar-project/.github#35 questo è oggi un no-op (BUILDPLATFORM coincide già con la piattaforma target in ogni job della matrix), ma allinea il Dockerfile alla pratica raccomandata e lo mette al riparo nel caso si torni in futuro a un builder singolo multi-platform.
https://claude.ai/code/session_01Xv1EAagQkhuCRGY584Kuua
Need help on this PR? Tag
/codesmithwith what you need. Autofix is enabled.What T-Rex did
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant BuildKit participant Base as base stage<br/>--platform=$BUILDPLATFORM participant Builder as builder stage BuildKit->>Base: Pull node:24-alpine for BUILDPLATFORM Base->>Builder: FROM base Builder->>Builder: pnpm install + prisma:generate + build Base->>Runner: FROM base Runner->>Runner: pnpm install --prod on inherited platform Runner-->>BuildKit: Final image uses inherited base platform%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant BuildKit participant Base as base stage<br/>--platform=$BUILDPLATFORM participant Builder as builder stage BuildKit->>Base: Pull node:24-alpine for BUILDPLATFORM Base->>Builder: FROM base Builder->>Builder: pnpm install + prisma:generate + build Base->>Runner: FROM base Runner->>Runner: pnpm install --prod on inherited platform Runner-->>BuildKit: Final image uses inherited base platformPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "build(docker): pin base stage to $BUILDP..." | Re-trigger Greptile