Skip to content

Allow docker build secrets to be files#14559

Draft
eerhardt wants to merge 1 commit intodotnet:release/13.2from
eerhardt:FixBuildSecrets
Draft

Allow docker build secrets to be files#14559
eerhardt wants to merge 1 commit intodotnet:release/13.2from
eerhardt:FixBuildSecrets

Conversation

@eerhardt
Copy link
Member

Description

This allows people to pass .npmrc files as docker secrets without baking auth credentials into this image.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

This allows people to pass .npmrc files as docker secrets without baking auth credentials into this image.
@github-actions
Copy link
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14559

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14559"

@mitchdenny
Copy link
Member

Do you think we should have `WithBuildSecretFile(callback) where we can give it a file, but defer evaluation.

foreach (var buildSecret in buildSecrets)
{
if (requireValue && buildSecret.Value is null)
if (buildSecret.Value.Type == BuildImageSecretType.File)
Copy link
Member

Choose a reason for hiding this comment

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

We should be explicit here and use type=file or type=env, as appropriate https://docs.docker.com/reference/cli/docker/buildx/build/#secret

Copy link
Member

Choose a reason for hiding this comment

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

Compare with https://docs.podman.io/en/latest/markdown/podman-build.1.html (supports the same type designator)

@dotnet-policy-service dotnet-policy-service bot added the needs-author-action An issue or pull request that requires more info or actions from the author. label Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-author-action An issue or pull request that requires more info or actions from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments