RedundantTargetPlatform(多餘的目標平台)
目錄
輸出
Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
說明
自訂平台可以用於基礎映像檔。預設平台與目標輸出平台相同,因此將平台設定為 $TARGETPLATFORM
是多餘且不必要的。
範例
❌ 不良:由於 $TARGETPLATFORM
是預設值,因此這種 --platform
的用法是多餘的。
FROM --platform=$TARGETPLATFORM alpine AS builder
RUN apk add --no-cache git
✅ 良好:省略 --platform
參數。
FROM alpine AS builder
RUN apk add --no-cache git