Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

Run container (docker in docker)

sudo docker run -p 8080:8080 --name jenkins --privileged -d yoheimuta/dockerjenkins

Register this build shell script (this example repository uses rake test) in jenkins free job

IMAGE=$(docker build . | tail -1 | awk '{print $NF}')

MNT="$WORKSPACE/.."

CONTAINER=$(docker run -d -v "$MNT:/opt/project" $IMAGE /bin/bash -c 'cd /opt/project/workspace && rake spec')

docker attach $CONTAINER

RC=$(docker wait $CONTAINER)

docker rm $CONTAINER

exit $RC

Register this build shell script (this example repository uses rake test) in jenkins multi configuration(added OS axis) job

cd $OS && IMAGE=$(docker build . | tail -1 | awk '{print $NF}')

MNT="$WORKSPACE/.."

CONTAINER=$(docker run -d -v "$MNT:/opt/project" $IMAGE /bin/bash -c "cd /opt/project/$OS && rake spec")

docker attach $CONTAINER

RC=$(docker wait $CONTAINER)

docker rm $CONTAINER

exit $RC

Docker Pull Command
Owner
yoheimuta
Source Repository

Comments (0)