Skip to content

Inline buildx global build and target platform envvars when resolving base image and user - #1169

Merged
Christof Marti (chrmarti) merged 2 commits into
devcontainers:mainfrom
trxcllnt:fix/275
Mar 17, 2026
Merged

Christof Marti (chrmarti) merged 2 commits into
devcontainers:mainfrom
trxcllnt:fix/275

Conversation

@trxcllnt

Copy link
Copy Markdown
Contributor

This PR ensures the buildkit global platform ARGs are respected in findBaseImage() and findUserStatement() functions.

These variables are valid in FROM lines, e.g.:

FROM ubuntu:latest as base-amd64
ENV MY_ARCH=amd64

FROM ubuntu:latest as base-arm64
ENV MY_ARCH=arm64

FROM base-${TARGETARCH}

ARG TARGETARCH

Without this change, the devcontainers CLI attempts to pull an image named base- rather than continue to walk the FROM tree to find ubuntu:latest.

Fixes #275

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks! Left a few comments.

Comment thread src/test/dockerfileUtils.test.ts Resolved
Comment thread src/test/dockerfileUtils.test.ts Resolved
Comment thread src/spec-node/imageMetadata.ts Resolved

@chrmarti Christof Marti (chrmarti) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks! (Will get an additional review before merging.)

@sam-byng Sam Byng (sam-byng) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrmarti
Christof Marti (chrmarti) merged commit 217ae9c into devcontainers:main Mar 17, 2026
24 checks passed
@trxcllnt
Paul Taylor (trxcllnt) deleted the fix/275 branch March 17, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

findBaseImage in dockerfileUtils.ts does not handle buildkit automatic variables in layers name

3 participants