Skip to content

Commit 96978d8

Browse files
committed
Merge pull request #49 from LucasGandel/add-docker-support
ENH: Add Docker Test file
2 parents 419d5a6 + 783cc1a commit 96978d8

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM debian:8
2+
MAINTAINER Insight Software Consortium <community@itk.org>
3+
4+
RUN apt-get update && apt-get install -y \
5+
build-essential \
6+
cmake \
7+
git \
8+
python \
9+
ninja-build \
10+
wget \
11+
vim
12+
13+
RUN mkdir -p /usr/src/SlicerExecutionModel-build
14+
WORKDIR /usr/src
15+
16+
ENV ITK_GIT_TAG v4.8.0
17+
RUN git clone git://itk.org/ITK.git && \
18+
cd ITK && \
19+
git checkout ${ITK_GIT_TAG} && \
20+
cd ../ && \
21+
mkdir ITK-build && \
22+
cd ITK-build && \
23+
cmake \
24+
-G Ninja \
25+
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
26+
-DBUILD_EXAMPLES:BOOL=OFF \
27+
-DBUILD_TESTING:BOOL=OFF \
28+
-DBUILD_SHARED_LIBS:BOOL=ON \
29+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
30+
-DITK_LEGACY_REMOVE:BOOL=ON \
31+
-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF \
32+
-DITK_USE_SYSTEM_LIBRARIES:BOOL=OFF \
33+
-DModule_ITKCommon:BOOL=ON \
34+
-DModule_ITKIOXML:BOOL=ON \
35+
-DModule_ITKExpat:BOOL=ON \
36+
../ITK && \
37+
ninja install && \
38+
rm -rf ITK ITK-build
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
die() {
4+
echo "Error: $@" 1>&2
5+
exit 1;
6+
}
7+
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
script_dir="`cd $(dirname $0); pwd`"
4+
5+
if [ ! $1 ];
6+
then
7+
die "Empty Image Tag "
8+
fi
9+
10+
lower_case_tag="`echo $1 | tr "[:upper:]" "[:lower:]" `"
11+
12+
docker run \
13+
--rm \
14+
-v $script_dir/../..:/usr/src/SlicerExecutionModel \
15+
slicer/slicerexecutionmodel:$lower_case_tag \
16+
/usr/src/SlicerExecutionModel/test/Docker/test.sh

test/Docker/test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# This is a script to build the project and run the test suite in the base
4+
# Docker container.
5+
6+
die() {
7+
echo "Error: $@" 1>&2
8+
exit 1;
9+
}
10+
11+
cd /usr/src/SlicerExecutionModel-build || die "Could not cd into the build directory"
12+
13+
cmake \
14+
-G Ninja \
15+
-DCMAKE_BUILD_TYPE:STRING=Release \
16+
/usr/src/SlicerExecutionModel || die "CMake configuration failed"
17+
ctest -VV -D Experimental || die "ctest failed"

0 commit comments

Comments
 (0)