First pass at official user-env-compile plugin
- Uses ENV and APP/ENV files - Supports old BUILD_ENV files (which are likely in wide-use) - Allows user's to override globals with app-specific configuration Closes #284 Closes #683 Closes #763 Refs #503 Refs #678
This commit is contained in:
21
plugins/build-env/pre-build
Normal file
21
plugins/build-env/pre-build
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/BUILD_ENV" ]]; then
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/BUILD_ENV")
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/APP/ENV" ]]; then
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/APP/ENV")
|
||||
fi
|
||||
|
||||
if [[ ! -z "$BUILD_ENV" ]]; then
|
||||
echo "-----> Adding BUILD_ENV to build environment..."
|
||||
id=$(echo "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
Reference in New Issue
Block a user