Skip to content

Commit b65034e

Browse files
authored
CI: Build docker image and push to dockerhub (#415)
1 parent ab2e2e9 commit b65034e

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

.github/workflows/ElastixGitHubActions.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
mv ${items[*]} Elastix-source
4747
mv .editorconfig Elastix-source
4848
mv .clang-format Elastix-source
49+
mv Elastix-source/Dockerfile .
4950
shell: bash
5051

5152
- uses: actions/cache@v2
@@ -54,8 +55,8 @@ jobs:
5455
path: |
5556
ITK-build
5657
ITK-source
57-
key: ${{ matrix.itk-git-tag }}-${{ matrix.os }}-${{ matrix.cmake-build-type }}
58-
58+
key: ${{ matrix.itk-git-tag }}-${{ matrix.os }}-${{ matrix.cmake-build-type }}
59+
5960
- name: Set up Python 3.7
6061
uses: actions/setup-python@v1
6162
with:
@@ -93,7 +94,6 @@ jobs:
9394

9495
- name: Build Elastix Unix
9596
if: matrix.os != 'windows-2019'
96-
9797
run: |
9898
mkdir Elastix-build
9999
cd Elastix-build
@@ -154,5 +154,20 @@ jobs:
154154
with:
155155
name: "${{ matrix.os }}"
156156
path: uploads
157+
158+
- name: Login to Docker Hub
159+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-18.04'
160+
uses: docker/login-action@v1
161+
with:
162+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
163+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
164+
165+
- name: Build and push
166+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-18.04'
167+
run: |
168+
mkdir output
169+
docker build -t superelastix/elastix:${GITHUB_REF#refs/tags/} .
170+
docker run -u $UID:$GROUPS --mount type=bind,source="$(pwd)"/output,target=/out -v "$(pwd)"/Elastix-source/Testing/Data:/elastix/ superelastix/elastix:${GITHUB_REF#refs/tags/} elastix -out /out/ -p /elastix/parameters.3D.NC.euler.ASGD.001.txt -f /elastix/3DCT_lung_baseline.mha -m /elastix/3DCT_lung_followup.mha
171+
docker push superelastix/elastix:${GITHUB_REF#refs/tags/}
157172
158173

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Makefile
3737
CMakeFiles/
3838
CTestTestfile.cmake
3939
.idea/
40+
.githooks/clangFormatMac

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM ubuntu:20.04
2+
3+
# Add labels to image
4+
LABEL documentation="https://github.com/SuperElastix/elastix/wiki"
5+
LABEL license="Apache License Version 2.0"
6+
LABEL modelzoo="https://elastix.lumc.nl/modelzoo/"
7+
8+
# Prepare system packages, libgomp1 is required by elastix
9+
RUN apt-get update && apt-get -qq install libgomp1 -y
10+
11+
# Copy necessary files
12+
COPY uploads/bin/* /usr/local/bin/
13+
COPY uploads/lib/* /usr/lib/
14+
15+
COPY uploads/LICENSE /
16+
COPY uploads/NOTICE /
17+
18+
CMD elastix

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Welcome to elastix: a toolbox for rigid and nonrigid registration of images.
88

9-
elastix is open source software, based on the well-known [Insight Segmentation and Registration Toolkit (ITK)](https://itk.org/). The software consists of a collection of algorithms that are commonly used to solve (medical) image registration problems. The modular design of elastix allows the user to quickly configure, test, and compare different registration methods for a specific application. A command-line interface enables automated processing of large numbers of data sets, by means of scripting. Nowadays elastix is accompanied by [SimpleElastix](http://simpleelastix.github.io/), making it available in languages like C++, Python, Java, R, Ruby, C# and Lua.
9+
elastix is open source software, based on the well-known [Insight Segmentation and Registration Toolkit (ITK)](https://itk.org/). The software consists of a collection of algorithms that are commonly used to solve (medical) image registration problems. The modular design of elastix allows the user to quickly configure, test, and compare different registration methods for a specific application. A command-line interface enables automated processing of large numbers of data sets, by means of scripting. Nowadays elastix is accompanied by [SimpleElastix](http://simpleelastix.github.io/), making it available in languages like C++, Python, Java, R, Ruby, C# and Lua. A docker image of the latest elastix build is available as well on [dockerhub](https://hub.docker.com/repository/docker/superelastix/elastix).
1010

1111
## Authors ##
1212

0 commit comments

Comments
 (0)