Evgeny Shvarov · May 4 2m read

The Update for a Default Dockerfile Template for development with InterSystems IRIS

Hi developer folks!

Thanks to all of you who start the development with InterSystems IRIS from the basic development template!

Recently, thanks to @Dmitry Maslennikov's contributions I've updated the Dockerfile to make the development simpler, images lighter and the building process faster. And it looks more beautiful too ;)

Here is what changed:

Let's go through the changes:

1. Lines 11-15 were substituted to only one line 7, that sets the WORKDIR. 

WORKDIR /home/irisowner/irisbuild

Indeed, if the WORKDIR points to a home folder of the user that runs iris then there is no need to perform security adjustments.

Of course I should change the line in iris.script to load zpm module from another workdir folder

2. Lines 17-21 were COPY commands that I used to use to copy different files from source folder of repo to an image to use it for iris or the environment.

now all these were substituted with one line

RUN --mount=type=bind,src=.,dst=. \

This syntax uses buildkit feature of Docker that allows mount files you need in the image without actually coping it. This saves the space and speeds up the building process.

So with this you can forget about COPY commands at all: everything from the repo folder will be mounted and available in a WORKDIR during the build phase. Beautiful, isn't it? Make sure you have this option turned on in your Docker:

3. What's added is the line with TEST parameter:


If TESTS=1 it makes Dockerfile to call unittest for ZPM module you develop in the project. This is being controlled with the following line:

([ $TESTS -eq 0 ] || iris session iris "##class(%ZPM.PackageManager).Shell(\"test $MODULE -v -only\",1,1)") && \

This TESTS parameter also helps to perform unit test automatically during the CI. This deserves and additional topic to discuss and I'll continue with this in the next article. 

Or you can check it in Dmitry's code if you don't want to wait )

Hope you liked it, but friendly feedback, concerns and pull requests are very welcome!

Happy coding! 

2 247
Discussion (4)1
Log in or sign up to continue

Great initiative,

I will try to apply this to most of my repository.

BTW, there is an easy way to enable BuildKit without editing the config file of docker :

Unix :

DOCKER_BUILDKIT=1 docker-compose build

Windows :

set "DOCKER_BUILDKIT=1" & docker-compose build

To find this quoting in Windows kept me busy for quite a while 2 months ago
as it wasn't part of the  !


Direct source code mounting in image is must have, thank you!