Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Docker buildx build context to dynamically replace FROM statements in Dockerfiles #1237

Open
lbussell opened this issue Apr 10, 2024 · 4 comments

Comments

@lbussell
Copy link
Contributor

Docker buildx has a feature that allows you to dynamically override any of the FROM statements in a Dockerfile at build-time. For example, --build-context mcr.microsoft.com/dotnet/runtime:8.0=mycustomacr.azurecr.io/repo:tag.

https://docs.docker.com/reference/cli/docker/buildx/build/#build-context

This means we wouldn't need to parameterize the source REPO of many of our Dockerfiles like we do today, making our Dockerfiles cleaner:
https://github.com/dotnet/dotnet-docker/blob/87b3735c6c2ba37277be80dd04099f6cb93e4bb7/src/aspnet/8.0/alpine3.18/arm32v7/Dockerfile#L1-L2

Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@lbussell lbussell changed the title Use Docker buildx build context to dynamically replace FROM statements Use Docker buildx build context to dynamically replace FROM statements in Dockerfiles Apr 10, 2024
@MichaelSimons
Copy link
Member

One question is if we would do this for linux only as Windows doesn't have official support for buildx yet (currently in-progress)?

@mthalman
Copy link
Member

This would allow us to get rid of this functionality too: #1031

@lbussell
Copy link
Contributor Author

[Triage] This would be nice to have. We need to do more investigation on the Windows BuildKit support (but that shouldn't necessarily block Linux adoption).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants