A dockerised, configured jenkins server with Pipeline and pre-coded jobs using JobDSL
221
A dockerised, configured jenkins server with Pipeline (https://jenkins.io/doc/book/pipeline/) and pre-coded jobs using JobDSL (https://wiki.jenkins.io/display/JENKINS/Job+DSL+Plugin). Based on the official jenkins/jenkins image.
Add jobs to the 'jobs.groovy' script using JobDSL. When run a jenkins server will be created with:
The jobs defined in 'jobs.groovy' will be run when the container starts.
docker system prune
docker-compose build
docker-compose up -d
Then point your browser to host:8080 and log in using admin/password. The jobs defined in 'jobs.groovy' should be running there.
An example Pipeline job named 'clone1' (https://github.com/tony-waters/clone1) is included. Jenkins runs the Jenkinsfile in 'clone1' as defined in 'jobs.groovy'
If you want to push to a registry from within your jobs Jenkinsfiles you must include a 'config.json' file, containing your registry credentials. This file is stored in ~/.docker on your local system when you have logged into your registry. Simply copy it from there into the root folder of this project and re-build.
A simple way of extending this image to run different jobs would be to use a Dockerfile like this:
FROM bit1/insta-jenkins
COPY jobs.groovy /tmp/copy/
This will replace the default jobs file with your own. A working example of this is in the 'derived-jenkins' directory.
Content type
Image
Digest
Size
568.4 MB
Last updated
over 8 years ago
docker pull bit1/insta-jenkins