Skip to content

Commit 783cc1a

Browse files
LucasGandeljcfr
andcommitted
ENH: Reorganize docker files to support testing against multiple ITK version
This commit extends Docker support allowing to have a Dockerfile for each version of ITK. Each Dockerfile is expected to be in a directory of this form: test/Docker-<IDENTIFIER> containing files "Dockerfile", "build.sh" and "run.sh". <IDENTIFIER> is a free form string allowing to loosely describe the the properties of the associated ITK build tree. This identifier will be used to specify the docker image tag in order to differenciate images regarding to their ITK build tree version. (It corresponds to variable 'image_tag' in build.sh) test/Docker-<IDENTIFIER>/build.sh: The ITK build tree is contained in the docker container that can be generated using the "build.sh" script and the associated "Dockerfile". test/Docker/test.sh: This script will (a) build SlicerExecutionModel against the ITK build tree available in the container obtained using "build.sh" (b) run SlicerExecutionModel tests Note that results of step (a) and (b) are both submitted to CDash. test/Docker-<IDENTIFIER>/run.sh: Allow to configure, build and test SlicerExecutionModel inside the docker container. Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
1 parent 03aa338 commit 783cc1a

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

test/Docker/Dockerfile renamed to test/Docker-ITK-v4.8.0_USE_SYSTEM_LIBRARIES-OFF/Dockerfile

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,17 @@ MAINTAINER Insight Software Consortium <community@itk.org>
33

44
RUN apt-get update && apt-get install -y \
55
build-essential \
6-
curl \
76
cmake \
87
git \
9-
libexpat1-dev \
10-
libhdf5-dev \
11-
libjpeg-dev \
12-
libpng12-dev \
13-
libpython3-dev \
14-
libtiff5-dev \
158
python \
169
ninja-build \
1710
wget \
18-
vim \
19-
zlib1g-dev
11+
vim
2012

2113
RUN mkdir -p /usr/src/SlicerExecutionModel-build
2214
WORKDIR /usr/src
2315

24-
# 2015-09-24
25-
ENV ITK_GIT_TAG cf05d9658da5f27c3ad6652028f563b50cf194b2
16+
ENV ITK_GIT_TAG v4.8.0
2617
RUN git clone git://itk.org/ITK.git && \
2718
cd ITK && \
2819
git checkout ${ITK_GIT_TAG} && \
@@ -38,10 +29,10 @@ RUN git clone git://itk.org/ITK.git && \
3829
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
3930
-DITK_LEGACY_REMOVE:BOOL=ON \
4031
-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF \
41-
-DITK_USE_SYSTEM_LIBRARIES:BOOL=ON \
32+
-DITK_USE_SYSTEM_LIBRARIES:BOOL=OFF \
4233
-DModule_ITKCommon:BOOL=ON \
4334
-DModule_ITKIOXML:BOOL=ON \
35+
-DModule_ITKExpat:BOOL=ON \
4436
../ITK && \
4537
ninja install && \
4638
rm -rf ITK ITK-build
47-
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
# Extract tag
4+
script_dir="`cd $(dirname $0); pwd`"
5+
image_tag="`echo $script_dir | rev | cut -d'/' -f 1 | rev | cut -d'-' -f 2-`"
6+
# Run common build script
7+
$script_dir/../Docker/build.sh $image_tag $script_dir
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
# Extract tag
4+
script_dir="`cd $(dirname $0); pwd`"
5+
image_tag="`echo $script_dir | rev | cut -d'/' -f 1 | rev | cut -d'-' -f 2-`"
6+
# Run common run script
7+
$script_dir/../Docker/run.sh $image_tag

test/Docker/build.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/sh
22

3-
script_dir="`cd $(dirname $0); pwd`"
3+
die() {
4+
echo "Error: $@" 1>&2
5+
exit 1;
6+
}
47

5-
docker build -t slicer/slicerexecutionmodel $script_dir
8+
if [ ! $1 ];
9+
then
10+
die "Empty Image Tag "
11+
fi
12+
13+
if [ ! $2 ];
14+
then
15+
die "Empty Path to Dockerfile "
16+
fi
17+
18+
lower_case_tag="`echo $1 | tr "[:upper:]" "[:lower:]" `"
19+
docker build -t slicer/slicerexecutionmodel:$lower_case_tag $2

test/Docker/run.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
script_dir="`cd $(dirname $0); pwd`"
44

5+
if [ ! $1 ];
6+
then
7+
die "Empty Image Tag "
8+
fi
9+
10+
lower_case_tag="`echo $1 | tr "[:upper:]" "[:lower:]" `"
11+
512
docker run \
613
--rm \
714
-v $script_dir/../..:/usr/src/SlicerExecutionModel \
8-
slicer/slicerexecutionmodel \
15+
slicer/slicerexecutionmodel:$lower_case_tag \
916
/usr/src/SlicerExecutionModel/test/Docker/test.sh

0 commit comments

Comments
 (0)