It was decided to use Azure for the project I'm doing now, and I was thinking of developing the screen with Java (Springboot) and deploying it in a container. You can deploy containers with AKS and WebApp on Linux, but ACI (Azure Container Instances) can be deployed more easily.
I would like to introduce the flow of deploying to Azure Container Instances using Jib for deploying to the registry.
Azure Container Registry
Add plugin
build.gradle
plugins {
id 'com.google.cloud.tools.jib' version '1.4.0'
}
Create an ACR repository and change the image name part. The user name and password should be described in gradle.properties.
build.gradle
jib {
to {
image = 'xxxxxx.azurecr.io/web'
auth {
username = "${USERNAME}"
password = "${PASSWORD}"
}
}
}
gradle.properties
USERNAME=xxxx
PASSWORD=xxxx
After that, if you type a command, it will create a container and push it to ACR.
$ gradlew jib
To create only the container, type the following command. (Once the container is created, it is good to check the operation with docker run)
$ gradlew jibDockerBuild
After logging in to Azure, just start Cloud Shell and type the following command.
az container create -g TEST-RG \
--name poc-web \
--image xxxxx.azurecr.io/web \
--ip-address public \
--registry-username xxxxx \
--registry-password yyyyyyyyy \
--ports 80 \
--dns-name-label zzzzzzz \
--environment-variables SPRING_PROFILES_ACTIVE=development
Get the log
az container logs --resource-group TEST-RG --name poc-web
Attach to log (leads to standard output of container)
az container attach --resource-group TEST-RG --name poc-web
Delete Containr Instances
az container delete -g TEST-RG --name poc-web
You can monitor using Azure Monitor, but it seems that you can not see the details with CPU, memory, network In / Out. For now, I think it would be like using SideCar to monitor for more metrics.
Anyway, it's Container Instances to easily deploy a container to Azure.