The built environment allows you to build source code inside an environment located on the host and within Docker, and the first sentence above identifies the workspace on the host.

The following four lines copy all repositories required into the workspace. The second export line defines the KivaKit Docker tags to start. The docker run command starts an environment for building.

Are you looking to know more about DevOps and pursuing in-depth knowledge and hands-on experience of various DevOps tools, including Git, Jenkins, Docker, Ansible, Terraform, Kubernetes, Prometheus, and Grafana. Etc? You should check for the DevOps Engineer Course.

Various build scripts are accessible within various build programs are accessible in the Docker build environment, and they're all available in the shell's PATH. To build KivaKit, it is recommended to use kivakit-build. Sh. Because this script is located within our PATH, it can create KivaKit without changing our working directory.

Create Workspaces

Once the Docker build environment begins to run, it's set to create a workspace within the container.

The built environment used for a baseline should function most of the time because this build system is standard, and the build must be working when the Docker image was made.

The familiar, standard build environment gives us an easy method of determining the source of the problem, code, or an issue with the built environment.

If the Docker workspace is built successfully and is stable, we can be confident that there's no issue with the code, even if the host workspace build does not succeed.

The kivakit-docker-build-workspace. the sh script allows us to switch between the Docker and host workspaces.

Initially, the workspace inside the Docker container is configured to build. If we would like to change the workspace to the host, then we need to issue the following instruction (use TAB to complete the long script name):

kivakit-docker-build-workspace.sh host

Moving to the host workspace will enable us to begin an initial version of the previously cloned code in that workspace.

After the host workspace is created, KivaKit projects can be transferred into an IDE such as IntelliJ.

But how does the process of switching workspaces function?

Note that the command docker run comes with three Docker-volume mounts. The option -volume makes a host folder visible within the Docker container.

volume [host-folder]:[docker-folder]

The docker run command we used above creates these three host folders available in the /host folder in Docker:

When we launch our Docker building environment, the KIVAKIT_WORKSPACE variable points to a workspace located in the /root directory inside our container.

Suppose we move to the host's workspace. In that case, the environment variable KIVAKIT_WORKSPACE and the symbolic link are changed to be directed to the folders assigned to the Docker container by the host (using the mount switches with the -volume option in the previous paragraphs).