Skip to content

Commit 9769ea1

Browse files
committed
Add option to source env from file
1 parent 8aa0020 commit 9769ea1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ docker run --rm --user=$(id -u) --volume=$HOME:$HOME:ro --workdir=$PWD --env=PLU
8686
| `annotation` | PLUGIN_ANNOTATION | `none` | Annotations (also known as labels) to add to image |
8787
| `push` | PLUGIN_PUSH | `true` | Push images if output names are set. |
8888
| `auth` | PLUGIN_AUTH | `none` | Auth for private registries |
89+
| `env-file` | PLUGIN_ENV_FILE | `none` | Source environment values from given file |
8990

9091
## Alternatives
9192

entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ set -eu;
55
## check input
66
##
77

8+
if [[ -n "${PLUGIN_ENV_FILE:-}" ]]; then
9+
if [[ ! -f "PLUGIN_ENV_FILE" ]]; then
10+
echo "Env file $PLUGIN_ENV_FILE not found."
11+
exit 1
12+
fi
13+
# shellcheck source=/dev/null
14+
source "$PLUGIN_ENV_FILE"
15+
fi
16+
817
BUILDCTL_CONTEXT=${PLUGIN_CONTEXT:-$(pwd)}
918
BUILDCTL_DOCKERFILE=$(dirname "${PLUGIN_DOCKERFILE:-$BUILDCTL_CONTEXT/Dockerfile}")
1019
if [[ ! -f $BUILDCTL_DOCKERFILE/Dockerfile ]]; then

0 commit comments

Comments
 (0)