Build mono3 docker container on the fly
Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/ef658f0b Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/ef658f0b Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/ef658f0b Branch: refs/heads/develop Commit: ef658f0bb14bacdce2080717d7c6734ef8d5489d Parents: 8f47155 Author: Dominik Psenner <[email protected]> Authored: Mon Jul 3 04:22:03 2017 +0200 Committer: Dominik Psenner <[email protected]> Committed: Mon Jul 3 04:22:03 2017 +0200 ---------------------------------------------------------------------- Jenkinsfile | 8 +++----- buildtools/docker/build.sh | 12 ++++++++++++ buildtools/docker/builder-mono3/Dockerfile | 9 +++++++++ buildtools/docker/cleanup-containers.sh | 5 +++++ buildtools/docker/cleanup-images.sh | 6 ++++++ buildtools/docker/cleanup.py | 13 +++++++++++++ buildtools/docker/nant/Dockerfile | 9 --------- 7 files changed, 48 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/Jenkinsfile ---------------------------------------------------------------------- diff --git a/Jenkinsfile b/Jenkinsfile index 05858db..a842088 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,12 +41,10 @@ pipeline { bat "${NAnt} -buildfile:log4net.build" } } - stage('Build on ubuntu') { - agent { label 'ubuntu' } + stage('Build on builder-mono3') { + agent { dockerfile 'buildtools/docker/builder-mono3' } steps { - docker.build("buildtools/docker/nant/").inside() { - sh "nant -buildfile:log4net.build" - } + sh "nant -buildfile:log4net.build" } } stage('Test on Windows') { http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/build.sh ---------------------------------------------------------------------- diff --git a/buildtools/docker/build.sh b/buildtools/docker/build.sh new file mode 100755 index 0000000..854746a --- /dev/null +++ b/buildtools/docker/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +if [ -z "$MY_PATH" ] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + exit 1 # fail +fi + +docker build --tag $1:latest $MY_PATH/$1 + http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/builder-mono3/Dockerfile ---------------------------------------------------------------------- diff --git a/buildtools/docker/builder-mono3/Dockerfile b/buildtools/docker/builder-mono3/Dockerfile new file mode 100644 index 0000000..663ee73 --- /dev/null +++ b/buildtools/docker/builder-mono3/Dockerfile @@ -0,0 +1,9 @@ +# Name of container: docker-ubuntu-latest-nant +from mono:3 + +# set the maintainer of this docker image +MAINTAINER "[email protected]" + +# install nant +RUN apt-get update && apt-get install -y nant git + http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/cleanup-containers.sh ---------------------------------------------------------------------- diff --git a/buildtools/docker/cleanup-containers.sh b/buildtools/docker/cleanup-containers.sh new file mode 100755 index 0000000..59ed689 --- /dev/null +++ b/buildtools/docker/cleanup-containers.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker stop $(docker ps -a -q) +docker rm $(docker ps -a -q) + http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/cleanup-images.sh ---------------------------------------------------------------------- diff --git a/buildtools/docker/cleanup-images.sh b/buildtools/docker/cleanup-images.sh new file mode 100755 index 0000000..c0e0796 --- /dev/null +++ b/buildtools/docker/cleanup-images.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +docker stop $(docker ps -a -q) +docker rm $(docker ps -a -q) +docker rmi $(docker images -a -q) + http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/cleanup.py ---------------------------------------------------------------------- diff --git a/buildtools/docker/cleanup.py b/buildtools/docker/cleanup.py new file mode 100755 index 0000000..c5534ef --- /dev/null +++ b/buildtools/docker/cleanup.py @@ -0,0 +1,13 @@ +#!/bin/bash + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +if [ -z "$MY_PATH" ] ; then + # error; for some reason, the path is not accessible + # to the script (e.g. permissions re-evaled after suid) + exit 1 # fail +fi + +$MY_PATH/cleanup-containers.sh +$MY_PATH/cleanup-images.sh + http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/ef658f0b/buildtools/docker/nant/Dockerfile ---------------------------------------------------------------------- diff --git a/buildtools/docker/nant/Dockerfile b/buildtools/docker/nant/Dockerfile deleted file mode 100644 index 593beef..0000000 --- a/buildtools/docker/nant/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -# base it on ubuntu:latest -from ubuntu:latest - -# set the maintainer of this docker image -LABEL maintainer "[email protected]" - -# install nant -RUN apt-get update && apt-get install -y nant -
