Add support for --secret option for buildkit support. #786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Heng GAO [email protected]
Description
I add a flag in the build command called --buildkit-secret to support one of the docker buildkit
option described in here:
https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information
The reason for this change is because i have this function depends on a private pypi repository which require senstive access information. To avoid put my credentials into the images, i decided to make this change to take the benifit of using docker buildkit to protect my secrets.
The flag added to the --buildkit-secret is same as the docker build --secret, i have successfully built this change and applied it locally to create a image using following command:
And in my dockerfile, i need to specify following changes to make this work:
Motivation and Context
This change is required because user's function might have dependencies that hosted on private pypi or gitlab, this change will help user to built their functions more securely.
Resolves: Support for buildkit --secret option #785
How Has This Been Tested?
New testing option added in the Test_buildFlagSlice to verify that the buildFlagSlice function can create the docker command flag correctly, and add a new testing function to make sure the docker command can be generated correctly.
Types of changes
Checklist:
git commit -s