This article is Request! Cloud Native application development tips![PR] It is his 20th day of Microsoft Japan Advent Calendar 2020 (I will write it later).
In this article, I would like to introduce how to deploy & continuously deploy Rails apps using Docker for Azure App Service.
The procedure is as follows.
The following is an example of the execution command in Azure CLI.
$ az login
$ az group create --name [Resource group name] --location [Resource group location]
$ az acr create --resource-group [Resource group name] --name [ACR name] --sku [Choice of favorite] --admin-enabled true --location [Same location as the resource group]
(Skip because it is not Azure CLI)
$ az acr login --name [ACR name]
$ docker push [ACR name and tag]
$ az appservice plan create --resource-group [Resource group name] --name [App Service Plan name] --sku [Specify B1 or S1] --location [Same location as the resource group] --is-linux
$ az webapp create --resource-group [Resource group name] --plan [App Service Plan name] --name [App Service name] --deployment-container-image-name [ACR name and tag]
$ az webapp config container set --name [App Service name] --resource-group [Resource group name] --docker-custom-image-name [ACR name and tag] --docker-registry-server-url [ACR location] --docker-registry-server-user [ACR name] --docker-registry-server-password [ACR Password]
$ az webapp deployment container config --resource-group [Resource group name] --name [App Service name] --enable-cd true
$ az acr webhook create --name [App Service name] --resource-group [Resource group name] --scope [ACR name and tag minus location] --location [Same location as the resource group] --uri [URI] --actions push delete
$ az webapp config appsettings set --settings RAILS_ENV=[Environment name] --name [App Service name] --resource-group [Resource group name]
Recommended Posts