Debian Codegraph @

buildkit/frontend/dockerfile/linter/docs/RedundantTargetPlatform.md

raw
1 ## Output
2
3 ```text
4 Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
5 ```
6
7 ## Description
8
9 A custom platform can be used for a base image. The default platform is the
10 same platform as the target output so setting the platform to `$TARGETPLATFORM`
11 is redundant and unnecessary.
12
13 ## Examples
14
15 ❌ Bad: this usage of `--platform` is redundant since `$TARGETPLATFORM` is the default.
16
17 ```dockerfile
18 FROM --platform=$TARGETPLATFORM alpine AS builder
19 RUN apk add --no-cache git
20 ```
21
22 ✅ Good: omit the `--platform` argument.
23
24 ```dockerfile
25 FROM alpine AS builder
26 RUN apk add --no-cache git
27 ```