Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce publish slug size #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed dotnet restore here because dotnet restore is now an implicit command, dotnet publish internally calls dotnet restore, no needs explicit call anymore.

Reference: dotnet/announcements#23


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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add chmod +x here because the executable generated from dotnet publish does not have "x" permission

Reference: dotnet/sdk#1331

EOT
7 changes: 7 additions & 0 deletions lib/utils
Original file line number Diff line number Diff line change
Expand Up @@ -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 "-----> $*"
Expand Down