Dapr (Distributed Application Runtime) is a runtime that helps you build resilient stateless and stateful microservices. This repository includes a Java-based Dapr application which is deployed to Azure Container Apps via a Bicep template.
-
Initialize Dapr:
dapr init
-
Build the Java packages:
./mvnw clean package
-
Run the Web API:
dapr run --components-path ./webapi/components --app-id webapi --app-port 3000 -- java -jar webapi/target/webapi-0.0.1-SNAPSHOT.jar --server.port=3000
-
Run the Web App:
dapr run --app-id webapp --app-port 8080 -- java -jar webapp/target/webapp-0.0.1-SNAPSHOT.jar --server.port=8080
-
Build containers images:
docker build -t <login-server>/java-app/webapi:v1 webapi docker build -t <login-server>/java-app/webapp:v1 webapp
-
Push container images to your Container Registry:
docker push <login-server>/java-app/webapi:v1 docker push <login-server>/java-app/webapp:v1
-
Set required environment variables:
RESOURCE_GROUP="my-containerapps" LOCATION="eastus2"
-
Create a resource group:
az group create \ --name $RESOURCE_GROUP \ --location "$LOCATION"
-
Deploy:
az deployment group create \ --resource-group "$RESOURCE_GROUP" \ --template-file ./infra/main.bicep \ --parameters \ registry_server="<registry_server>" \ registry_username="<registry_username>" \ registry_password="<registry_password>"