These sample repo will help you to deploy a simple containerised WebApp to Azure AppService from a Azure Container Registry.
- You already have an active Azure Subscription
- You have a Github account and you perform basic operations
- You have basic understanding of git operations.
-
Login to your Github account Fork the repo (containing the simple docker application) to your github account: https://github.com/Bapic/simpleDockerAppService.git
-
Generate a PAT for your github account to use with Cloud Shell https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token. Save it securely.
-
Login to your Azure portal and launch the Cloud Shell
-
Run the below commands to clone the repo locally:
git config --global user.email "your email"
git config --global user.name "your github username"
git clone https://github.com/Bapic/simpleDockerAppService.git
cd simpleDockerAppService
git remote show origin or git remote -v. # Ensure your repo is set to use your repo as the origin
git add .
git commit -m "Initial commit"
code index.js # make some change to the text of the response body.
git push origin master # Once done, check your git hub repo for the changes.
-
Run the below commands (deployment script in the making) to deploy an App service, App service plan and ACR
REGION_NAME=eastus
RESOURCE_GROUP=DockerAppServiceRG-$RANDOM
APP_NAME=simpleDockerAppService$RANDOM
ACR_NAME=acr$RANDOM
az group create --location $REGION_NAME --name $RESOURCE_GROUP
az appservice plan create --name $APP_NAME --resource-group $RESOURCE_GROUP --location $REGION_NAME --is-linux --sku S1
az webapp create --name $APP_NAME --plan $APP_NAME --resource-group $RESOURCE_GROUP -i nginx
az acr create
--resource-group $RESOURCE_GROUP
--location $REGION_NAME
--name $ACR_NAME
--sku Standard -
Navigate to the ACR you created and ensure Admin access is enabled and creds are upated in the "Container settings" of the WebApp. If not please update.
-
Now, manually configure the Deployment Source as Github with Azure DevOps pipelines with continuous deployment.
-
Make changes to the App files txt, push the changes and that should reflect on the site instantly.