Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

Saturday, January 9, 2021

Easily managing your build environments

Have you come across situations where your build tools suddenly stop working after you update the operating system? Do you want a simple way of setting up your build environment each time you change or format your machine?


One option is to use Docker-based build environments. In this approach, you can create Docker images with the necessary build tools and dependencies. However, you will still have to remember the tags, mount your source code manually, and execute docker commands with multiple arguments each time. This approach is right but needs some effort.


To address the issues in the approach mentioned above, The Condo [1] was developed. The Condo is a simple bash script that wraps all the necessary docker commands you need to manage your build environments.


You can install condo by running the following command


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jsdjayanga/condo/main/scripts/install.sh)"


Following are four simple commands that the Condo supports.


List build environments

    condo list

Run a build environment. condo <build-env-name>

    condo devj11

Stop a build environment. condo stop <build-env-name>

  condo stop devj11

Clean a build environment. condo clean <build-env-name>

  condo clean devj11


The configuration file (~/.condo/condo.json) allows to store all the necessary information to run the respective Docker images hence allowing you to run the docker image with just the name of the environment.

You can configure and add as many as build environment you like, e.g., java, golang, spring, or any custom docker image of your choice. Furthermore, the "additional-arguments" section in the configuration allows you to provide any docker compliant arguments to your docker image.

Try the Condo your self share your experience!

[1] https://github.com/jsdjayanga/condo

Thursday, January 17, 2019

Building your own JDK distributions

Everyone started to talk about openJDK[1] with the new licensing that Oracle introduced in January 2019. According to Oracle[2] public updates for Java SE8[3] will be available until the end of 2020 for individual personal use but not for business, commercial or production use[4].

 This lead people to look into alternative JDK distributions. AdoptOpenJDK[5] and AWS Corretto [6] seems to be good options. However, by the time this post is written, AWS Corretto still in its preview state.

By the way, the aim of this post is not to talk about other OpenJDK distributions but to build your JDK distribution.

Let's get our hands dirty.
Hmmmmm, no, you don't have to get your hands dirty. I have made it super simple for you :). I have made a docker image[7] which contains all the necessary dependent tools and libraries. Just follow the below mantioned steps and you will have your own OpenJDK distribution.

Note: Install Docker[1], if you haven't done it yet.

1. Pull the docker image

docker pull jsdjayanga/ubuntu-openjdk8-build

2. Spin up a container with the above image

docker run -it jsdjayanga/ubuntu-openjdk8-build

3. Go to source the directory

cd jdk8u

4. Checkout the tag

hg checkout jdk8u192-b12

5. Run the configure. You can set your name as the release user if you wish by setting --with-user-release-suffix

bash configure --enable-unlimited-crypto --with-user-release-suffix=jsdjayanga --with-build-number=b01 --with-milestone=192

6. Create images

make images

This process would take 30min to 1h and finally, you have your own OpenJDK distribution in the following location.

/jdk8u/build/linux-x86_64-normal-server-release/images

Try this is out and share your experience :)


[1] https://openjdk.java.net/
[2] https://www.oracle.com/index.html
[3] https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 
[4] https://java.com/en/download/release_notice.jsp
[5] https://adoptopenjdk.net/
[6] https://aws.amazon.com/corretto/
[7] https://hub.docker.com/r/jsdjayanga/ubuntu-openjdk8-build