Remove the need for temp files
This commit is contained in:
1 parent
b01d371c46
commit
a62f914646
1 file changed
+2
-10
@@ -67,20 +67,12 @@ case "$1" in
|
|||||||
pluginhook pre-release-buildstep "$APP"
|
pluginhook pre-release-buildstep "$APP"
|
||||||
pluginhook pre-release-buildpack "$APP"
|
pluginhook pre-release-buildpack "$APP"
|
||||||
if [[ -n $(config_export global) ]]; then
|
if [[ -n $(config_export global) ]]; then
|
||||||
mkdir -p "$DOKKU_ROOT/$APP/.dokku/tmp"
|
id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
|
||||||
TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku/tmp/.XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir"
|
|
||||||
trap 'rm -rf "$TMPFILE" > /dev/null' INT TERM EXIT
|
|
||||||
config_export global > $TMPFILE
|
|
||||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$TMPFILE")
|
|
||||||
test "$(docker wait $id)" -eq 0
|
test "$(docker wait $id)" -eq 0
|
||||||
docker commit $id $IMAGE > /dev/null
|
docker commit $id $IMAGE > /dev/null
|
||||||
fi
|
fi
|
||||||
if [[ -n $(config_export app $APP) ]]; then
|
if [[ -n $(config_export app $APP) ]]; then
|
||||||
mkdir -p "$DOKKU_ROOT/$APP/.dokku/tmp"
|
id=$(config_export app $APP | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
|
||||||
TMPFILE=$(mktemp $DOKKU_ROOT/$APP/.dokku/tmp/XXXXXX) || dokku_log_fail "Cannot create temp file using mktemp in /tmp dir"
|
|
||||||
trap 'rm -rf "$TMPFILE" > /dev/null' INT TERM EXIT
|
|
||||||
config_export app $APP > $TMPFILE
|
|
||||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$TMPFILE")
|
|
||||||
test "$(docker wait $id)" -eq 0
|
test "$(docker wait $id)" -eq 0
|
||||||
docker commit $id $IMAGE > /dev/null
|
docker commit $id $IMAGE > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user