From 501163931d0fe2e5f6de4e0892cbeecbc5a72a5d Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 25 May 2022 13:01:06 +0100 Subject: [PATCH] Don't delete the build directory root (#2) Since otherwise once Heroku builds are run from `/app`, builds will output warnings due to the `/app` root being read only: ``` remote: -----> Subdir buildpack app detected ... remote: cleaning build dir /app remote: rm: cannot remove '/app': Read-only file system ``` Fixes #9. Co-authored-by: Alexey Timanovsky --- bin/compile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index e8bf558..63fd849 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,9 @@ #!/usr/bin/env bash # bin/compile +# Ensure wildcards in globs match dotfiles too. +shopt -s dotglob + BUILD_DIR=${1:-} CACHE_DIR=${2:-} ENV_DIR=${3:-} @@ -16,9 +19,7 @@ if [ -f $ENV_DIR/PROJECT_PATH ]; then echo " moving working dir: $PROJECT_PATH to $TMP_DIR" cp -R $BUILD_DIR/$PROJECT_PATH/. $TMP_DIR/ echo " cleaning build dir $BUILD_DIR" - rm -rf $BUILD_DIR - echo " recreating $BUILD_DIR" - mkdir -p $BUILD_DIR + rm -rf $BUILD_DIR/* echo " copying preserved work dir from cache $TMP_DIR to build dir $BUILD_DIR" cp -R $TMP_DIR/. $BUILD_DIR/ echo " cleaning tmp dir $TMP_DIR"