Docker images published for every commit to docker hub

18 views
Skip to first unread message

Waldek Kozaczuk

unread,
Mar 9, 2020, 4:33:17 PM3/9/20
to OSv Development
Lately I had a chance to refine our docker files and setup a build process in docker hub to build and publish OSv builder images:
As you can see there are 2 images - one based on Fedora 31 and another on Ubuntu 19.10 - that are built and published to docker hub and automatically triggered

You can also see them here after you click on that green check left to the 'Latest commit ...':

Screen Shot 2020-03-09 at 12.04.53 PM.png

The images are built on docker hub infrastructure based on these docker files - 
They have the 'base' prefix in name for a reason - each is tailored to a specific Linux distribution and roughly is made of the packages installed by setup.py and capstan binary. Also both of them take an input argument - DIST_VERSION - which allows building images specific for arbitrary version of Fedora or Ubuntu (the default is 29 for fedora and 19.04 for ubuntu) like in this example:

docker build -t osvunikernel/osv-fedora-31-builder-base -f Dockerfile.builder-fedora-base --build-arg DIST_VERSION=31 .
 
Then there is also a new docker file called Dockerfile.builder - https://github.com/cloudius-systems/osv/blob/master/docker/Dockerfile.builder- which is based on one of the above ones and is distribution-agnostic. It mainly clones the main repo and runs setup.py just in case any packages that are part of the distribution base image are outdated.

ARG DIST="fedora-29"
FROM osvunikernel/osv-${DIST}-builder-base

# - prepare directories
RUN mkdir -p /git-repos

# - clone OSv
WORKDIR /git-repos
ARG GIT_ORG_OR_USER=cloudius-systems
WORKDIR /git-repos/osv
RUN git submodule update --init --recursive

# - update all required packages in case they have changed
RUN scripts/setup.py

CMD /bin/bash

As you can see it also takes an input argument letting one specify which distribution to use like in this example:

docker build -t osv/builder-fedora-31 -f Dockerfile.builder --build-arg DIST="fedora-31" --build-arg GIT_ORG_OR_USER=a_user .

Now what is the advantage of docker and the distribution base images that get published on each commit? For anyone that has OSv setup on their favorite distribution there is not much advantage out right. But what if I have Ubuntu and wanted to test OSv on Fedora or vice versa? Or wanted to test on different version of Ubuntu because it has newer gcc or qemu? That is where docker images and containers to build and run OSv in it become really handy.

Finally we .travis.yml also uses Dockerfile.builder that in turn relies on pre-built base build image and that speeds up the entire new CI process which I will describe in my next email.

I hope you will find it useful,
Waldek
Reply all
Reply to author
Forward
0 new messages