From d0d16af942dbe12afa78a33fa8de370b8ea8b4c2 Mon Sep 17 00:00:00 2001 From: Karl Wan Date: Wed, 6 Sep 2017 20:06:40 +0800 Subject: [PATCH] Removed dotnet restore, uses self-contained parameter, added cleanup --- bin/compile | 10 +++++----- lib/utils | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/compile b/bin/compile index e28d68c9..52e9d107 100755 --- a/bin/compile +++ b/bin/compile @@ -41,12 +41,12 @@ dotnet --info PROJECT_FILE=$(x=$(dirname $(find ${BUILD_DIR} -maxdepth 5 -iname Startup.cs | head -1)); while [[ "$x" =~ $BUILD_DIR ]] ; do find "$x" -maxdepth 1 -name *.csproj; x=`dirname "$x"`; done) PROJECT_NAME=$(basename ${PROJECT_FILE%.*}) -echo "restore ${PROJECT_FILE}" -dotnet restore $PROJECT_FILE --runtime linux-x64 - echo "publish ${PROJECT_FILE}" -dotnet publish $PROJECT_FILE --output ${BUILD_DIR}/heroku_output --configuration Release --runtime linux-x64 +dotnet publish $PROJECT_FILE --output ${BUILD_DIR}/heroku_output --configuration Release --runtime linux-x64 --self-contained + +echo "cleanup" +dotnet_cleanup $BUILD_DIR cat << EOT >> ${BUILD_DIR}/Procfile -web: cd \$HOME/heroku_output && ASPNETCORE_URLS='http://+:\$PORT' dotnet "./${PROJECT_NAME}.dll" --server.urls http://+:\$PORT +web: cd \$HOME/heroku_output && chmod +x ${PROJECT_NAME} && ASPNETCORE_URLS='http://+:\$PORT' ./${PROJECT_NAME} --server.urls http://+:\$PORT EOT \ No newline at end of file diff --git a/lib/utils b/lib/utils index 858c0c7f..4a1a38c3 100755 --- a/lib/utils +++ b/lib/utils @@ -9,6 +9,13 @@ function install_dotnet() { ln -s ${BUILD_DIR}/.heroku/dotnet /app } +function dotnet_cleanup() { + local BUILD_DIR="$1" + + rm /app/dotnet + rm -rf ${BUILD_DIR}/.heroku/dotnet +} + # https://github.com/ddollar/heroku-buildpack-apt function topic() { echo "-----> $*"