diff --git a/Dockerfile b/Dockerfile index 88cd1aa..55b5a73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ ARG registry=docker.io ARG maintainer=tier ARG imagename=shibboleth_idp ARG version=3.2.1 - ENV VERSION=$version MAINTAINER $maintainer @@ -17,4 +16,34 @@ LABEL ImageName=$imagename LABEL ImageOS=centos7 LABEL Version=$VERSION -CMD echo $VERSION \ No newline at end of file +RUN yum -y install \ + apr-devel \ + httpd \ + java-1.8.0-openjdk-headless \ + krb5-workstation \ + mod_ssl \ + openssl-devel \ + tomcat \ + tomcat-native.x86_64 \ + wget \ + && yum -y clean all + +ENV SHIB_RELDIR=http://shibboleth.net/downloads/identity-provider/$VERSION +ENV SHIB_PREFIX=shibboleth-identity-provider-$VERSION + +RUN mkdir -p /tmp/shibboleth && cd /tmp/shibboleth && \ + wget -q https://shibboleth.net/downloads/PGP_KEYS \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.asc \ + $SHIB_RELDIR/$SHIB_PREFIX.tar.gz.sha256 && \ +# Perform verifications + gpg --import PGP_KEYS && \ + gpg $SHIB_PREFIX.tar.gz.asc && \ + sha256sum --check $SHIB_PREFIX.tar.gz.sha256 && \ +# Prepare filesystem + tar xf $SHIB_PREFIX.tar.gz && \ + mkdir -p /opt/shibboleth && \ + mv $SHIB_PREFIX /opt/shibboleth/. && \ + ln -s /opt/shibboleth/$SHIB_PREFIX /opt/shibboleth/current && \ +# Cleanup + rm -rf /tmp/shibboleth \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 5e32a7b..d0c4a24 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,17 +10,11 @@ node { stage 'Base' - sh './build_image.sh' + sh 'bin/build.sh' stage 'Tests' - sh '/usr/local/bin/bats tests/shibboleth-idp.bats' + sh '/usr/local/bin/bats tests' - # stage 'Push' - # if(env.BRANCH_NAME == "master") - # docker.withRegistry('https://registry.hub.docker.com/', 'dockerhub-bigfleet') { - # def baseImg = docker.build('$env.DOCKERHUB_ACCOUNT/shib_') - # baseImg.push('latest') - # } } \ No newline at end of file diff --git a/bin/rebuild.sh b/bin/rebuild.sh new file mode 100755 index 0000000..3904e58 --- /dev/null +++ b/bin/rebuild.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source bin/destroy.sh && source bin/build.sh \ No newline at end of file diff --git a/bin/rerun.sh b/bin/rerun.sh index da1dff6..e279386 100755 --- a/bin/rerun.sh +++ b/bin/rerun.sh @@ -1,3 +1,3 @@ #!/bin/bash -source bin/destroy.sh && source bin/build.sh && source bin/run.sh \ No newline at end of file +source bin/rebuild.sh && source bin/run.sh $1 \ No newline at end of file diff --git a/bin/run.sh b/bin/run.sh index 3509fb8..8af1b06 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -2,4 +2,4 @@ source common.bash . -docker run $maintainer/$imagename \ No newline at end of file +docker run -it $maintainer/$imagename $1 \ No newline at end of file diff --git a/tests/shibboleth-idp.bats b/tests/shibboleth-idp.bats index 8274927..a2b2640 100644 --- a/tests/shibboleth-idp.bats +++ b/tests/shibboleth-idp.bats @@ -2,12 +2,17 @@ load ../common -@test "file reading" { - result="$(echo $maintainer)" - [ "$result" = 'bigfleet' ] +@test "Creates non-root Shib IDP home" { + result="$(docker run -i bigfleet/shibboleth_idp ls /opt/shibboleth/current/bin/)" + [ "$result" != '' ] } -@test "container output" { - result="$(docker run bigfleet/shibboleth_idp)" - [ "$result" = '3.2.1' ] +@test "Retains first-run experience" { + result="$(docker run -i bigfleet/shibboleth_idp ls /tmp/firsttimerunning)" + [ "$result" != '' ] +} + +@test "Contains java" { + run docker run -i bigfleet/shibboleth_idp which java + [ "$status" -eq 0 ] } \ No newline at end of file