Java8 Alpine Dockerfile Curl

As of Alpine Linux 3.3 there exists a new --no-cache option for apk. It allows users to install packages with an index that is updated and used on-the-fly and not cached locally: FROM openjdk:8-jre-alpine RUN apk --no-cache add curl This avoids the need to use --update and remove /var/cache/apk/* when done installing packages. Reference - https://github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md

August 3, 2024 · 1 min · Imran

Spring Boot Dynamic Beans Example

You can create dynamic & configuration driven beans in Spring Boot in following way. Note: Below example full code is available at https://github.com/imran9m/spring-boot-dynamic-beans For the example, Let’s create dynamic RestClient beans with customized connection timeout and user-agent configuration to use anywhere we want. Let’s go with following configuration to manage customized properties for two dynamic RestClient beans. application.yml restClients: clients: - clientName: test1 connectionTimeout: 6000 responseTimeout: 6000 userAgent: test1 - clientName: test2 connectionTimeout: 5000 responseTimeout: 5000 userAgent: test2 Now, let’s load this configuration into custom configuration properties record....

January 2, 2025 · 4 min · Imran

Get PublicIP of ECS Fargate Task with AWS Java SDK

You will need to make multiple AWS API calls to get Public IPv4 address. Here are the steps. Once you perform taskRun operation. Keep taskFullArn from Output. With above taskArn and cluster name, make describeTasks operation call. Example - AmazonECS client = AmazonECSClientBuilder.standard().build(); DescribeTasksRequest request = new DescribeTasksRequest().withTasks("c5cba4eb-5dad-405e-96db-71ef8eefe6a8"); DescribeTasksResult response = client.describeTasks(request); Above API will give you a response with network attachment details. "attachments": [ { "id": "xxxxx-d02c-4a9d-ae79-xxxxxxx", "type": "ElasticNetworkInterface", "status": "ATTACHED", "details": [ { "name": "subnetId", "value": "subnet-xxxxx" }, { "name": "networkInterfaceId", "value": "eni-e5aa89a3" }, { "name": "macAddress", "value": "xxxxx" }, { "name": "privateIPv4Address", "value": "172....

August 3, 2024 · 1 min · Imran