This example assumes you have previously completed the following examples:
- Create an Azure Resource Group
- Create an Azure Container Registry
- Push a Tomcat Docker image to Azure Container Registry
- Create settings.xml using admin access keys
- Create an Azure App Service Plan
To deploy Tomcat use the following command lines:
export APPSERVICE_DOCKER_TOMCAT=appservice-docker-tomcat-$RANDOM
mvn azure-webapp:deploy \
--settings=$SETTINGS_XML \
-DappName=$APPSERVICE_DOCKER_TOMCAT \
-DimageName=$ACR_TOMCAT_IMAGE \
-DappServicePlan=$APPSERVICE_PLAN \
-DresourceGroup=$RESOURCE_GROUP \
-DserverId=$ACR_NAME
az webapp show \
--resource-group $RESOURCE_GROUP \
--name $APPSERVICE_DOCKER_TOMCAT \
--query 'hostNames[0]' \
--output tsv
Then open your browser to the URL shown as output and you should see:
And this is served by a custom Tomcat using a Docker image coming from our
own Azure Container Registry.
The example supports the following properties that you can pass in as -Dname=value to the Maven command line to customize your deployment.
name | description |
---|---|
appName |
the application name |
appServicePlan |
the App Service plan to use |
imageName |
the Docker image name |
serverId |
the Maven server id |
registry |
the Azure Container Registry name |
registryUrl |
the Azure Container Registry url |
resourceGroup |
the Azure Resource Group name |
Do NOT forget to remove the resources once you are done running the example.
3m