Handler: io.micronaut.function.aws.proxy.payload1.ApiGatewayProxyRequestEventFunction
If you want to deploy to AWS Lambda as a GraalVM native image, run:
./gradlew buildNativeLambda -Pmicronaut.runtime=lambda
This will build the GraalVM native image inside a docker container and generate the function.zip
ready for the deployment.
Workflow file: .github/workflows/graalvm.yml
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.
- Docker login(
docker/login
) - Setup GraalVM(
DeLaGuardo/setup-graalvm
)
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. |
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.
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
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
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
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
./gradlew :app:buildNativeLambda
./gradlew test
The infra/cdk.json
file tells the CDK Toolkit how to execute your app.
cd infra
cdk synth
- emits the synthesized CloudFormation template
cdk deploy
- deploy this stack to your default AWS account/region
cd ..
Other useful commands:
cdk diff
- compare deployed stack with current state
cdk docs
- open CDK documentation
cd infra
cdk destroy
cd ..
-
Micronaut AWS Parameter Store Distributed Configuration documentation
-
https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html