Add option to source env from file
This commit is contained in:
parent
8aa00208d3
commit
d6a335c91e
2 changed files with 9 additions and 0 deletions
|
@ -86,6 +86,7 @@ docker run --rm --user=$(id -u) --volume=$HOME:$HOME:ro --workdir=$PWD --env=PLU
|
|||
| `annotation` | PLUGIN_ANNOTATION | `none` | Annotations (also known as labels) to add to image |
|
||||
| `push` | PLUGIN_PUSH | `true` | Push images if output names are set. |
|
||||
| `auth` | PLUGIN_AUTH | `none` | Auth for private registries |
|
||||
| `env-file` | PLUGIN_ENV_FILE | `none` | Source environment values from given file |
|
||||
|
||||
## Alternatives
|
||||
|
||||
|
|
|
@ -5,6 +5,14 @@ set -eu;
|
|||
## check input
|
||||
##
|
||||
|
||||
if [[ -n "${PLUGIN_ENV_FILE:-}" ]]; then
|
||||
if [[ ! -f "PLUGIN_ENV_FILE" ]]; then
|
||||
echo "Env file $PLUGIN_ENV_FILE not found."
|
||||
exit 1
|
||||
fi
|
||||
source "$PLUGIN_ENV_FILE"
|
||||
fi
|
||||
|
||||
BUILDCTL_CONTEXT=${PLUGIN_CONTEXT:-$(pwd)}
|
||||
BUILDCTL_DOCKERFILE=$(dirname "${PLUGIN_DOCKERFILE:-$BUILDCTL_CONTEXT/Dockerfile}")
|
||||
if [[ ! -f $BUILDCTL_DOCKERFILE/Dockerfile ]]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue