Created
December 1, 2022 07:43
-
-
Save huksley/919ba2a48c3d3931770d80f99adf8cfc to your computer and use it in GitHub Desktop.
Pass environment variables in the shell to subcommand by some prefix, e.g. DOCKER_
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pass all DOCKER_ARG_NAME=VALUE as --build-arg NAME=VALUE | |
docker buildx build . --tag test1 \ | |
(for N in "${!DOCKER_ARG_@}"; do echo -n "--build-arg ${N/DOCKER_ARG_/}=${!N} "; done) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment