Insights

Advantages of containerisation using buildpacks

Hexis insight into containerisation using buildpacks.

in Software developmentBy Carlos Camara, Managing Partner

In Hexis, we have experienced through multiple nearshore projects in Portugal, the importance and advantages of containerisation. Mainly in projects where the software was rapidly scaling, and teams were moving at a fast pace due to the project constraints.

The initial approach that the project team was having to respond to this fast-moving pace was through the use of dockers. This approach was translating into a quick cost saving in terms of infrastructure and speed but creating a future problem of scalability, working in silos and having a view only in the scope of the own deployment pipeline, without a view of the big picture, while having to maintain the build and runtime environment.

The solution

The solution to improve and ensure continuity in the long run of the solution was the use of containerisation with buildpacks. This solution allowed the developers to perform at the application level upgrades, creating docker images without docker files and running containerised code with almost zero configuration.

The use of dockers has many advantages, allowing the rapid scaling of projects and controlling infrastructure costs. The advantages come at the expense of the dependencies necessary at the source code level, leading to challenges at the build and runtime level, wherein specific scenarios the docker files had to go to all the source code. The use of docker files at source code leads to a complexity of assessing all the dependencies to run at the production level. e.g. of a simple docker in node that had to go to all the source code:

-- docker file
FROM Ubuntu 19.04
COPY ./app
RUN make install_node
RUN make install_yarn
CMD yarn

The advantages of containers comprise the source code that can be inserted into a buildpack, as a way to manage containers with scalability, adding source code to output a docker image. This approach is divided into four phases:

1. Detect script

Through a detect script, a piece of runnable source code (e.g. json) can be inserted, if the code language matches the buildpack, lead to a build step.

2. Build step

Installs node modules dependencies such as typescripts and others, then run and compile steps.

3. Export step

Takes all the artefacts that have been created and export them into a runtime image.

4. Caching

Manages all the reusable artefacts from the build and makes them available after the build, leading to efficiencies.

This process can be done locally through the installation of a docker (view docs.docker.com), installing the pack command-line tool (view buildpacks.io), and adding some source code available (e.g. for a node project will need to have a package.json file).

Buildpacks have advantages in the management of dependencies when the project is scaling, one important to highlight is that an update can be done locally and push the updated layer to the registry in the cloud, ensuring coherence and save time. Another positive point about layers, although one can say the first image can be slower to build, in subsequent builds, it will be applied the artefacts cache and speeds up the entire process. This layer update can be done through toml file caching node modules, yarn and node.

Conclusion

In conclusion, there many advantages to the use of containerisation. Considering its use with could native buildpacks this translates into a modular, scalable and efficient environment.

Buildpack not only takes the advantages of docker layers logically mapped to source code dependencies and components but also the use of multiple buildpacks that can suit the needs of any container. The scalability of use through multiple projects with the same technology and the fact that the source code can be free of an underline configuration leads to efficiency. The fact that the containers use cache reusing artefacts lead to a quicker push to cloud, and the docker features also enable an agile development workflow.

Lastly, buildpacks remove the learning curve for a developer to get started with containers.

Powered by ChronoForms - ChronoEngine.com

Get in touch