Setting `FROM --platform` pointing to a stage is silently ignored
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
I naively tried something like this in my project:
FROM alpine AS base
FROM --platform=${BUILDPLATFORM} base AS expensive
RUN sleep 100 && uname -a > /foo
FROM scratch AS final
COPY --from=expensive /foo .
My expectation was that the expensive stage would only run once on my native platform. However, I see it running twice in parallel
This however only runs the expensive stage once:
FROM --platform=${BUILDPLATFORM} alpine AS expensive
RUN sleep 100 && uname -a > /foo
FROM scratch AS final
COPY --from=expensive /foo .
My guess is that --platform only applies to docker image sources? Should it be an error if used with something else?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two Dockerfile examples in the issue and compare how the stage-based and image-based FROM --platform forms are processed. Trace the Dockerfile frontend handling for FROM and stage references; done means the behavior is either corrected or an explicit error and regression coverage are established for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile, go
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100