A repository of scripts to set up a Slicer build environment.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Docker Set TAG to latest Oct 18, 2018
License.txt Initial commit Mar 26, 2018
README.rst README: Add "Tagging a build environment image" maintainer guide Oct 18, 2018


Slicer Build Environment

This project is under active development. Its content, API and behavior may change at any time. We mean it.


This project streamlines the continuous integration (CI) and allows anyone to easily reproduce builds. Currently, it contains only a Docker directory that itself contain a sub-directory associated with each available build environment.

  |--- Docker
          |--- qt4-centos5
          |          |--- Dockerfile
          |--- qt4-ubuntu1004
          |          |--- Dockerfile
          |--- qt5-centos7
          |          |--- Dockerfile
          |--- Makefile

Docker-based Environments

Each sub-directory (e.g qt5-centos7) contains a Dockerfile allowing to generate a reusable build environment (or docker image). That build environment includes a version of qt (e.g qt5) and is based on a given operating system (e.g centos5).

Available build environments

buildenv-qt4-ubuntu1004-latest Build environment based on Ubuntu 10.04 and including Qt 4.8.6
buildenv-qt4-centos5-latest Build environment based on Centos5 and including Qt 4.8.7
buildenv-qt5-centos7-slicer-4.10 Build environment based on Centos7 and including Qt 5.11.2
buildenv-qt5-centos7-latest Build environment based on Centos7 and including Qt 5.11.2

Visual Overview



The interesting part is that the recipe associated with each SlicerBuildEnvironment image is only responsible to install (or build) Qt, the remaining of the tools forming the complete compiling environment are provided by some other base images provided by the dockbuild project.

dockbuild is a project responsible to create base docker image that includes a tested compiling environment, latest git version, cmake, ninja, python 3 and openssh-client. And also a convenience entrypoint allowing to automatically mount the current working directory into the image.

dockbuild was itself inspired by dockcross, a collection of docker image providing cross-compiling environment. It even re-use the same tests and entrypoint script.


How to locally build the docker images ?

To build all images:

cd Docker

To build a specific image:

cd Docker
make qt5-centos7

Configure, build and package Slicer for Linux

The following steps will:

  • download Slicer 4.8.1 source code
  • download the associated build environment
  • configure, build and package Slicer
mkdir -p $ROOT_DIR

cd ${ROOT_DIR}

# Download sources
svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Slicer -r 26813

# Download corresponding build environment and generate convenience script
docker run --rm slicer/buildenv-qt4-ubuntu1004 > ~/bin/slicer-buildenv-qt4-ubuntu1004
chmod u+x ~/bin/slicer-buildenv-qt4-ubuntu1004

# Configure Slicer
slicer-buildenv-qt4-ubuntu1004 cmake \
  -BSlicer-build -HSlicer \
  -GNinja \
  -DSlicer_USE_SimpleITK:BOOL=OFF \

# Build Slicer
slicer-buildenv-qt4-ubuntu1004 cmake --build Slicer-build

# Package Slicer
slicer-buildenv-qt4-ubuntu1004 cmake --build Slicer-build/Slicer-build --target package

Configure, build and package a Slicer extension for Linux

The following steps will:

  • download an extension source code
  • configure, build and package the extension using the build generated in the previous tutorial

cd ${ROOT_DIR}


# Download extension source
git clone git://github.com/finetjul/ImageMaker ${EXTENSION_NAME}

# Configure the extension
slicer-buildenv-qt4-ubuntu1004 cmake \
  -GNinja \

# Hint: /work is the working directory in the image, it corresponds to
#       the directory from which the script `slicer-buildenv-qt4-ubuntu1004` is called.

# Build the extension
slicer-buildenv-qt4-ubuntu1004 cmake --build ${EXTENSION_NAME}-build

# Package the extension
slicer-buildenv-qt4-ubuntu1004 cmake --build ${EXTENSION_NAME}-build --target package


Tagging a build environment image

  1. Choose a tag (e.g slicer-X.Y)
  1. Update Docker/Makefile with the chosen tag
sed -i -E "s/^TAG = .+$/TAG = ${TAG}/g" Docker/Makefile
  1. Add an entry in README.rst referencing the chosen tag
  2. Commit the changes
git add README.rst Docker/Makefile
git commit -m "Set TAG to ${TAG}"
  1. Build and publish an image
cd Docker
make <name-of-image>
make <name-of-image>.push
  1. Update Docker/Makefile with the "latest" tag
sed -i -E "s/^TAG = .+$/TAG = latest/g" Docker/Makefile
  1. Commit the changes
git add README.rst
git commit -m "Set TAG to latest"