Micronaut 3.1.3 Documentation
Push GraalVM Native Image To Docker Registry Workflow
Workflow file: .github/workflows/graalvm.yml
Workflow description
For pushes to the master
branch, the workflow will:
- Setup the build environment with respect to the selected java/graalvm version.
- Login to docker registry based on provided configuration.
- Build, tag and push Docker image with Micronaut application to the Docker container image.
Dependencies on other GitHub Actions
- Docker login(
docker/login
) - Setup GraalVM(
DeLaGuardo/setup-graalvm
)
Setup
Add the following GitHub secrets:
Name | Description |
---|---|
DOCKER_USERNAME | Username for Docker registry authentication. |
DOCKER_PASSWORD | Docker registry password. |
DOCKER_REPOSITORY_PATH | Path to the docker image repository inside the registry, e.g. for the image foo/bar/micronaut:0.1 it is foo/bar . |
DOCKER_REGISTRY_URL | Docker registry url. |
Configuration examples
Specifics on how to configure public cloud docker registries like DockerHub, Google Container Registry (GCR), AWS Container Registry (ECR), Oracle Cloud Infrastructure Registry (OCIR) and many more can be found in docker/login-action documentation.
DockerHub
DOCKER_USERNAME
- DockerHub usernameDOCKER_PASSWORD
- DockerHub password or personal access tokenDOCKER_REPOSITORY_PATH
- DockerHub organization or the username in case of personal registryDOCKER_REGISTRY_URL
- No need to configure for DockerHub
Google Container Registry (GCR)
Create service account with permission to edit GCR or use predefined Storage Admin role.
DOCKER_USERNAME
- set exactly to_json_key
DOCKER_PASSWORD
- content of the service account json key fileDOCKER_REPOSITORY_PATH
-<project-id>/foo
DOCKER_REGISTRY_URL
-gcr.io
AWS Elastic Container Registry (ECR)
Create IAM user with permission to push to ECR (or use AmazonEC2ContainerRegistryFullAccess role).
DOCKER_USERNAME
- access key IDDOCKER_PASSWORD
- secret access keyDOCKER_REPOSITORY_PATH
- no need to setDOCKER_REGISTRY_URL
- set to<aws-account-number>.dkr.ecr.<region>.amazonaws.com
Oracle Infrastructure Cloud Registry (OCIR)
Create auth token for authentication.
DOCKER_USERNAME
- username in format<tenancy>/<username>
DOCKER_PASSWORD
- account auth tokenDOCKER_REPOSITORY_PATH
-<tenancy>/<registry>/foo
DOCKER_REGISTRY_URL
- set to<region>.ocir.io
Azure Container Instance GraalVM Workflow
Workflow file: .github/workflows/azure-container-instance-graalvm.yml
Workflow description
For pushes to the master
branch, the workflow will:
- Setup the build environment with respect to the selected java/graalvm version.
- Login to Docker registry.
- Login to Azure Command-Line Interface.
- Build, tag and push Docker image with Micronaut application to the Docker Registry.
- Deploy to Azure Container Instances.
Dependencies on other GitHub Actions
- Login to Docker Registry
docker/login
- Setup GraalVM
DeLaGuardo/setup-graalvm
- Setup Azure CLI
azure/login
Setup
Add the following GitHub secrets:
Name | Description |
---|---|
DOCKER_USERNAME | Docker registry username. In case of Azure Container Registry, provide Azure username or Service principal ID, see more on Azure Container Registry authentication with service principals. |
DOCKER_PASSWORD | Docker registry password. In case of Azure Container Registry, provide Azure password or Service principal password. |
DOCKER_REPOSITORY_PATH | Docker image repository. In case of Azure Container Registry, for image micronaut.azurecr.io/foo/bar:0.1 , the foo is an image repository. |
DOCKER_REGISTRY_URL | Docker registry url. In case of Azure Container Registry use the Container registry login path, e.g. for the image micronaut.azurecr.io/foo/bar:0.1 , the micronaut.azurecr.io is a registry url. |
AZURE_CREDENTIALS | Azure Service Principal, see more on Azure/aci-deploy#Azure Service Principal for RBAC. |
AZURE_RESOURCE_GROUP | Azure Resource Group name, see more on Resource groups. |
The workflow file also contains additional configuration options that are now configured to:
Name | Description | Default value |
---|---|---|
AZURE_LOCATION | Location where the Container Instance will be created. See Resource availability for Azure Container Instances in Azure regions to find out what regions are supported. | westeurope |
AZURE_DNS_LABEL | The dns name label for container group with public IP. | microkaos |
Verification
Call the rest api endpoint [AZURE_DNS_LABEL].[AZURE_LOCATION].azurecontainer.io:[PORT]/microkaos
:
curl http://microkaos.westeurope.westeurope.azurecontainer.io:8080/microkaos
Push To Docker Registry Workflow
Workflow file: .github/workflows/gradle.yml
Workflow description
For pushes to the master
branch, the workflow will:
- Setup the build environment with respect to the selected java/graalvm version.
- Login to docker registry based on provided configuration.
- Build, tag and push Docker image with Micronaut application to the Docker container image.
Dependencies on other GitHub Actions
- Docker login(
docker/login
) - Setup GraalVM(
DeLaGuardo/setup-graalvm
)
Setup
Add the following GitHub secrets:
Name | Description |
---|---|
DOCKER_USERNAME | Username for Docker registry authentication. |
DOCKER_PASSWORD | Docker registry password. |
DOCKER_REPOSITORY_PATH | Path to the docker image repository inside the registry, e.g. for the image foo/bar/micronaut:0.1 it is foo/bar . |
DOCKER_REGISTRY_URL | Docker registry url. |
Configuration examples
Specifics on how to configure public cloud docker registries like DockerHub, Google Container Registry (GCR), AWS Container Registry (ECR), Oracle Cloud Infrastructure Registry (OCIR) and many more can be found in docker/login-action documentation.
DockerHub
DOCKER_USERNAME
- DockerHub usernameDOCKER_PASSWORD
- DockerHub password or personal access tokenDOCKER_REPOSITORY_PATH
- DockerHub organization or the username in case of personal registryDOCKER_REGISTRY_URL
- No need to configure for DockerHub
Google Container Registry (GCR)
Create service account with permission to edit GCR or use predefined Storage Admin role.
DOCKER_USERNAME
- set exactly to_json_key
DOCKER_PASSWORD
- content of the service account json key fileDOCKER_REPOSITORY_PATH
-<project-id>/foo
DOCKER_REGISTRY_URL
-gcr.io
AWS Elastic Container Registry (ECR)
Create IAM user with permission to push to ECR (or use AmazonEC2ContainerRegistryFullAccess role).
DOCKER_USERNAME
- access key IDDOCKER_PASSWORD
- secret access keyDOCKER_REPOSITORY_PATH
- no need to setDOCKER_REGISTRY_URL
- set to<aws-account-number>.dkr.ecr.<region>.amazonaws.com
Oracle Infrastructure Cloud Registry (OCIR)
Create auth token for authentication.
DOCKER_USERNAME
- username in format<tenancy>/<username>
DOCKER_PASSWORD
- account auth tokenDOCKER_REPOSITORY_PATH
-<tenancy>/<registry>/foo
DOCKER_REGISTRY_URL
- set to<region>.ocir.io