RedundantTargetPlatform
目錄
輸出
Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
描述
基礎映象可以使用自定義平臺。預設平臺與目標輸出平臺相同,因此將平臺設定為 `TARGETPLATFORM` 是多餘且不必要的。
示例
❌ 不良:此 `—platform` 用法是多餘的,因為 `TARGETPLATFORM` 是預設值。
FROM --platform=$TARGETPLATFORM alpine AS builder
RUN apk add --no-cache git
✅ 良好:省略 `—platform` 引數。
FROM alpine AS builder
RUN apk add --no-cache git