BerandaComputers and TechnologyShlax Container Builder Preview

Shlax Container Builder Preview

In a world where Dockerfiles, docker-compose.yml files, ansible files, and
others compete for my attention against tech debt in projects that become a bit
complex: I decided to make a Python micro framework to make it as nice to build
an infra as I think it is to build a CRUD with Django.

Shlax is meant to be a multi purpose automation framework, where logic to
acheive a certain state can be easily shared accross container building, host
provisioning, infrastructures with virtual systems and networks. Most of it is
not production ready yet, but the container building part seems to get me the
best I can get:

  • Distribution package host caching
  • Python and NodeJS host caching

No more waiting for all packages to download again, I’m not always near my
local mirrors

I also like that Shlax mounts user home pip and npm cache directories inside
the containers so that the cache is shared with my localhost.


You can play with :

git clone
cd shlax
pip3 install -e .[test,cli]
./ build
py.test -sv tests

Caching walkthrough

The container build recipe looks like this:

shlax = Container(
        Packages('python38', 'buildah', 'unzip', 'findutils', upgrade=False),
        Copy('', 'shlax', '/app'),

This is what it looks like on my machine with cache hits:


Maybe should silent errors in the “Invalidating old layers” code.

So if I change the above build script to add the “most” package it will invalidate all layers:


But reuse the local package cache (what a relief ..):


Same story of course with a python package, for example adding the “django” package will make the build start from the Pip layer:


But it won’t hit the network because it shares the same cache as my local pip command which is shared with the Pip action, you can see how it commits the layer at the end:


And cleaner code which proceeds to umounts of mounts made by different actions, and commit:


Read More



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments