# HG changeset patch # User am@osimis.io # Date 1532005440 -7200 # Node ID 02c83c12d3d59244d68a3298282c009ca2c7708d # Parent e252d740436f4224e64d8f747c5e121098cc7c67 added jenkins build diff -r e252d740436f -r 02c83c12d3d5 .dockerignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.dockerignore Thu Jul 19 15:04:00 2018 +0200 @@ -0,0 +1,6 @@ +scripts/ +NEWS +NOTES.txt +README +Jenkinsfile +Dockerfile \ No newline at end of file diff -r e252d740436f -r 02c83c12d3d5 Dockerfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dockerfile Thu Jul 19 15:04:00 2018 +0200 @@ -0,0 +1,31 @@ + +FROM jodogne/orthanc:1.2.0 + +WORKDIR /root/source + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install \ + libxml++2.6-dev libxml++2.6-doc uuid-dev \ + git \ + python3-dev \ + python3.4-venv \ + python3-pip && \ + rm -rf /var/lib/apt/lists/* + +# Used to copy the plugin to AWS after successful integration tests +RUN pip3 install awscli + +COPY . /root/source/ + +# Build the plugin +RUN mkdir /root/build/ +WORKDIR /root/build +RUN cmake -DALLOW_DOWNLOADS=ON \ + -DSTATIC_BUILD=ON \ + -DCMAKE_BUILD_TYPE=Release \ + /root/source +RUN make "--jobs=$(grep --count ^processor /proc/cpuinfo)" +RUN make install + +ENTRYPOINT [ "Orthanc" ] +CMD [ "/etc/orthanc/" ] diff -r e252d740436f -r 02c83c12d3d5 Jenkinsfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jenkinsfile Thu Jul 19 15:04:00 2018 +0200 @@ -0,0 +1,21 @@ +try { + node('docker') { + stage 'Retrieve sources' + deleteDir() + checkout scm + + lock(resource: 'orthanc-authorization-plugin', inversePrecedence: false) { + stage 'Build Docker image & run unit tests' + sh 'scripts/ciBuildDockerImage.sh' + } + + withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'aws-orthanc.osimis.io']]) { + stage 'Push Docker plugin to AWS' + sh 'scripts/ciPushToAws.sh ${BRANCH_NAME}' + } + } +} +catch (e) { + slackSend color: '#FF0000', message: "${env.JOB_NAME} has failed ${env.JOB_URL}" + throw e +} \ No newline at end of file diff -r e252d740436f -r 02c83c12d3d5 NEWS --- a/NEWS Fri Mar 09 10:29:15 2018 +0100 +++ b/NEWS Thu Jul 19 15:04:00 2018 +0200 @@ -2,6 +2,8 @@ =============================== +* Added automated build + 2018-03-08 - v 0.2.0 ==================== diff -r e252d740436f -r 02c83c12d3d5 scripts/ciBuildDockerImage.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/ciBuildDockerImage.sh Thu Jul 19 15:04:00 2018 +0200 @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Builds the Orthanc authorization plugin Docker image +# Arguments: + +set -x # Trace execution +set -e # Stop on error +set -u # Stop on uninitialized variable + +docker build -t osimis/orthanc-authorization-plugin . diff -r e252d740436f -r 02c83c12d3d5 scripts/ciPushToAws.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/ciPushToAws.sh Thu Jul 19 15:04:00 2018 +0200 @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Builds the MSSQL Orthanc plugin Docker image +# Arguments: +# $1 - Git branch name + +set -e # Stop on error +set -u # Stop on uninitialized variable +set -x # Trace execution + +branchName=${1:-$(hg branch)} #if no argument defined, get the branch name from git +commitId=$(hg identify --id) + +if [[ $branchName == "default" ]]; then + releaseTag=$commitId +else + releaseTag=$branchName +fi + +docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY --entrypoint bash osimis/orthanc-authorization-plugin -c \ + "aws s3 --region eu-west-1 cp /usr/local/share/orthanc/plugins/libOrthancAuthorization.so s3://orthanc.osimis.io/docker-so/orthanc-authorization/$releaseTag/ --cache-control max-age=1" \ No newline at end of file