Last active
November 2, 2021 11:55
-
-
Save Swimburger/8edfc108797636cc9b5509d8588d170e to your computer and use it in GitHub Desktop.
Create and Deploy Blazor WASM to Heroku using heroku-buildpack-static (ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# start onetime setup | |
# make sure to have 'jq' installed | |
# sudo snap install jq | |
mkdir BlazorWasmHeroku | |
cd BlazorWasmHeroku | |
dotnet new blazorwasm | |
heroku login | |
heroku plugins:install heroku-cli-static | |
AppId=$(heroku create --no-remote --json | jq -r '.id') | |
heroku buildpacks:set https://github.com/hone/heroku-buildpack-static -a $AppId | |
heroku static:init | |
# update static.json to including SPA routing | |
echo $(cat static.json | jq '.routes={"/**": "index.html"}') > static.json | |
# end onetime setup | |
dotnet publish -c Release -o release | |
heroku static:deploy -a $AppId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For full-blown guides on deploying Blazor to other platforms, check out the Blazor category at swimburger.net: https://swimburger.net/blog/blazor?viewall=true#main-content