Category Archives: Tiny Tips

Tiny Tips: Build and export results with Docker

Hello and welcome to our tiny tip of the day!

I wish to build an experimental standalone binary app in controlled environment and just pull out the results on my machine, so I can avoid installing all the build dependencies.

Shouldn’t Docker help me with such thing? And sure it DOES xD!

I’ve mainly used Docker to create runnable images with web applications exposing their ports, so this was new for me! I hope you find it simple and useful too!

1. Create your build Dockerfile as usual and then add a scratch images to expose only the result files:

# Dockerfile with conventional Java Application build with Gradle
FROM eclipse-temurin:17-jdk-jammy as build

WORKDIR /app

COPY build.gradle .
COPY gradlew .
COPY settings.gradle .
COPY gradle/ ./gradle
COPY src/ ./src

RUN ./gradlew build

# Expose /build content 
FROM scratch AS binaries
COPY --from=build /app/build /

scratch is the minimal image used to create base images in Docker

2. Build image with output and target params

In your preferred terminal, navigate at your Dockerfile directory and run the following command:

docker build --output=<OUTPUT_PATH> --target=<TARGET_NAME> .

TARGET_NAME: the instruction name inside your Dockerfile where you’ve placed the result files.

OUTPUT_PATH: the path on your machine to where you want to copy the result files

For the Dockerfile sample above, run the following command to get the output in the ./bin folder:

And… Dekiagari (Voila)!

Check the ./bin folder created with all the generated resources resulting from the build action.

Read the complete documentation from official Docker website here 🙂

Hope you find it useful! You can fund the sample code in my repository here. Have a nice coding day!

Always Free Cloud Services

After hosting The Senior Journey session, sponsored by Oracle Cloud, I was so impressed with their always free tier package!

We can achieve so many things with that! From running simple experiments to publish small production level solutions! All for free!

That made me curious!

What other cloud providers free tier offers, such as in Amazon, Google and Microsoft?

I end up finding this GitHub repository collecting all these information for us 😀

To have a quick view:

1. AWS Free Tier

Always Free

  • Amazon DynamoDB (NoSQL): 25 GB of storage
  • AWS Lambda (FaaS): 1 Million free requests per month
  • Amazon SNS: 1 Million publishes

2. Azure Free Tier

Free for Limited-time

  • US$200 credit for 30 days
  • Popular services free for 12 months

Always Free

  • 54+ other services free always

3. Google Cloud Free Tier

Always Free

  • Compute VM: 0.25 vCPU, 1G RAM (only on us-west1, us-central1 and us-east1)
  • 1GB of network egress (except China and Australia)
  • 5GB Storage (only on us-west1, us-central1, us-east1, asia-east1 and europe-west1)

4. Oracle Cloud Free Tier

Free for Limited-time

  • US$300 credit for 30 days
  • Up to eight instances across all available services
  • Up to 5 TB of storage

Always Free

  • Compute:
    • 2 AMD-based VMs: 0.25 vCPU and 1 GB RAM each;
    • 4 Arm-based VMs: 24 GB RAM total, 3,000 vCPU hours and 18,000 GB hours per month;
  • 2 Block Volumes Storage, 200 GB total;
  • 10 GB Object Storage – Standard;
  • 10 GB Object Storage – Infrequent Access;
  • 10 GB Archive Storage;
  • 10TB of network egress;
  • Load Balancer;
  • Monitoring and Notifications;
  • Two Oracle Autonomous Databases incl. Oracle Application Express (APEX), Oracle SQL Developer etc.

Not bad uhh?! Have you already created your own Cloud account? Or made use of these amazing services and try some interesting Cloud Architectures? Share in the comments 🙂