SlideShare a Scribd company logo
1 of 17
Jenkins on Docker
craigtrim@gmail.com
Extend
FROM jenkins
MAINTAINER Craig Trim "craigtrim@gmail.com"
ENV MAVEN_HOME /usr/lib/apache/maven/3.3.1
ENV PATH /usr/lib/apache/maven/3.3.1/bin:$PATH
USER root
RUN export DEBIAN_FRONTEND=noninteractive && 
apt-get update
RUN 
mkdir -p $MAVEN_HOME && 
cd $MAVEN_HOME && 
wget http://mirrors.ibiblio.org/apache/maven/maven-
3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz && 
tar -zxvf apache-maven-3.3.1-bin.tar.gz && 
mv apache-maven-3.3.1/* . && 
rm -rf apache-maven-3.3.1
USER jenkins
• Extend the official docker Jenkins file to
install Maven
• Official Image
• https://registry.hub.docker.com/_/jenkins/
• Extended Image
• https://github.com/torrances/docker/tree/master/jenkins
Build and Launch
• Build the docker image
• “craig/jenkins“
• Launch a container
• Expose on port 8040 (arbitrary)
• -p 8040:8080
• Inject a host directory
• This will contain all the Jenkins
customizations: build configurations,
credentials, workspace and built artifacts
• Around 130 MB immediately, and can
become very large over time
• -v ~/jpr:/var/jenkins_home
• Code is on the next page
• I like to use a shell script that handles any
host system manipulation and then calls
a docker-compose script
Docker (and docker-compose) installation script:
https://github.com/torrances/bash/blob/master/install/docker.sh
Build and Launch
docker-compose.yml
jenkins:
build: .
ports:
- "8040:8080"
volumes:
- ~/jpr:/var/jenkins_home
hostname:
jenkins
privileged:
false
run.sh
mkdir ~/jpr
sudo docker-compose up
View
• Pull up a web browser!
Further Configuration (creating new jobs):
http://trimc-devops.blogspot.com/p/masterpage.html#jenkins
Add Maven
Installation
• Click on Manage Jenkins
Add Maven
Installation
• Click on Configure System
Add Maven
Installation
• Scroll down
• Click the Add Maven button
• Unselect the Install automatically
checkbox
• In the Name textbox, put maven
• In the MAVEN_HOME textbox, enter the
path from the Dockerfile
(/usr/lib/apache/maven/3.3.1)
• Click Save
Maven Installation and Usage:
http://trimc-devops.blogspot.com/p/masterpage.html#maven
Install the Git Plugin
• Go back to the dashboard
• Select Manage Jenkins from the left-hand
nav
• Select Manage Plugins from the list
Install the Git Plugin
• Click on the Available tab
• Type github in the Filter text area
Install the Git Plugin
• Scroll down and select Github Plugin
• Click Install without restart
Install the Git Plugin
• Wait for the installation to complete
Install the Git Plugin
• Wait for the installation to complete
Install the Git Plugin
• Once the installation is complete, check
the Restart Jenkins when installation is
complete and no jobs are running
checkbox
Install the Git Plugin
• This will immediately restart Jenkins
Thanks!
Things that I haven’t got around to doing yet …
• Look into the use of a docker host to dynamically provision a slave,
run a single build, and tear down the host:
• https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin
• Install plugins (like Git) dynamically
• https://registry.hub.docker.com/_/jenkins/
• Do I need to install Maven on Docker first, or can this be installed
automatically when Jenkins initializes?

More Related Content

What's hot

Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
dirtytactics
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 

What's hot (20)

Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
Managing Jenkins with Jenkins (Jenkins User Conference Palo Alto, 2013)
 
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS) Par Jean-...
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS)  Par Jean-...XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS)  Par Jean-...
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS) Par Jean-...
 
Grooving with Jenkins
Grooving with JenkinsGrooving with Jenkins
Grooving with Jenkins
 
Hand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef ResourcesHand Crafted Artisanal Chef Resources
Hand Crafted Artisanal Chef Resources
 
Introduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷JavaIntroduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷Java
 
Install Concourse CI with BOSH
Install Concourse CI with BOSHInstall Concourse CI with BOSH
Install Concourse CI with BOSH
 
Dockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber ExampleDockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber Example
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Code fast & Break things with Jenkins & Continuous Integration
Code fast & Break things with Jenkins & Continuous IntegrationCode fast & Break things with Jenkins & Continuous Integration
Code fast & Break things with Jenkins & Continuous Integration
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
ChefConf 2016 - Writing Compossible Community Cookbooks using Chef Custom Res...
 
20140924 3 Deutsches VuFind-Anwendertreffen _ filipe bento EBSCO (English)
20140924   3 Deutsches VuFind-Anwendertreffen _ filipe bento EBSCO (English)20140924   3 Deutsches VuFind-Anwendertreffen _ filipe bento EBSCO (English)
20140924 3 Deutsches VuFind-Anwendertreffen _ filipe bento EBSCO (English)
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Auto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSHAuto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSH
 
Hacking Maven Linux day 2017
Hacking Maven Linux day 2017Hacking Maven Linux day 2017
Hacking Maven Linux day 2017
 
Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
Keep Your Servers in GitHub
Keep Your Servers in GitHubKeep Your Servers in GitHub
Keep Your Servers in GitHub
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
 

Viewers also liked

Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Carlos Sanchez
 

Viewers also liked (14)

Dockerized maven
Dockerized mavenDockerized maven
Dockerized maven
 
What is this "docker"
What is this  "docker" What is this  "docker"
What is this "docker"
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017
 
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter DanesUsing Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
 
TDC2016SP - Testes unitários e testes de integração de aplicações Java utiliz...
TDC2016SP - Testes unitários e testes de integração de aplicações Java utiliz...TDC2016SP - Testes unitários e testes de integração de aplicações Java utiliz...
TDC2016SP - Testes unitários e testes de integração de aplicações Java utiliz...
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
 
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
 
Continuous Integration using Docker & Jenkins
Continuous Integration using Docker & JenkinsContinuous Integration using Docker & Jenkins
Continuous Integration using Docker & Jenkins
 
Jenkins Docker
Jenkins DockerJenkins Docker
Jenkins Docker
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Docker for Java Developers
Docker for Java DevelopersDocker for Java Developers
Docker for Java Developers
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 

Similar to Jenkins on Docker

Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Rashedul Islam
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
moirarandell
 

Similar to Jenkins on Docker (20)

Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments
 
Extracting twitter data using apache flume
Extracting twitter data using apache flumeExtracting twitter data using apache flume
Extracting twitter data using apache flume
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECS
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Setup a Dev environment that feels like $HOME on Windows 10
Setup a Dev environment that feels like $HOME on Windows 10Setup a Dev environment that feels like $HOME on Windows 10
Setup a Dev environment that feels like $HOME on Windows 10
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with Docker
 
How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
 

More from Craig Trim

The art of tokenization
The art of tokenizationThe art of tokenization
The art of tokenization
Craig Trim
 

More from Craig Trim (19)

Publishing Python to PyPI using Github Actions.pptx
Publishing Python to PyPI using Github Actions.pptxPublishing Python to PyPI using Github Actions.pptx
Publishing Python to PyPI using Github Actions.pptx
 
Ontologies and the Semantic Web
Ontologies and the Semantic WebOntologies and the Semantic Web
Ontologies and the Semantic Web
 
SAS Visual Process Flows
SAS Visual Process FlowsSAS Visual Process Flows
SAS Visual Process Flows
 
SAS University Edition - Getting Started
SAS University Edition - Getting StartedSAS University Edition - Getting Started
SAS University Edition - Getting Started
 
Bluemix NL Classifier Tutorial
Bluemix NL Classifier TutorialBluemix NL Classifier Tutorial
Bluemix NL Classifier Tutorial
 
Bluemix - Deploying a Java Web Application
Bluemix - Deploying a Java Web ApplicationBluemix - Deploying a Java Web Application
Bluemix - Deploying a Java Web Application
 
IBM Bluemix - Building a Project with Maven
IBM Bluemix - Building a Project with MavenIBM Bluemix - Building a Project with Maven
IBM Bluemix - Building a Project with Maven
 
Question Types in Natural Language Processing
Question Types in Natural Language ProcessingQuestion Types in Natural Language Processing
Question Types in Natural Language Processing
 
IBM Bluemix: Creating a Git Project
IBM Bluemix: Creating a Git ProjectIBM Bluemix: Creating a Git Project
IBM Bluemix: Creating a Git Project
 
Things and strings public
Things and strings   publicThings and strings   public
Things and strings public
 
Octave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning AlgorithmsOctave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning Algorithms
 
PROV Overview
PROV OverviewPROV Overview
PROV Overview
 
The Onomyicon
The OnomyiconThe Onomyicon
The Onomyicon
 
Dependency parsing (2013)
Dependency parsing (2013)Dependency parsing (2013)
Dependency parsing (2013)
 
Inference using owl 2.0 semantics
Inference using owl 2.0 semanticsInference using owl 2.0 semantics
Inference using owl 2.0 semantics
 
An Introduction to the Jena API
An Introduction to the Jena APIAn Introduction to the Jena API
An Introduction to the Jena API
 
The art of tokenization
The art of tokenizationThe art of tokenization
The art of tokenization
 
Deep Parsing (2012)
Deep Parsing (2012)Deep Parsing (2012)
Deep Parsing (2012)
 
Ontology and semantic web (2016)
Ontology and semantic web (2016)Ontology and semantic web (2016)
Ontology and semantic web (2016)
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Jenkins on Docker

  • 2. Extend FROM jenkins MAINTAINER Craig Trim "craigtrim@gmail.com" ENV MAVEN_HOME /usr/lib/apache/maven/3.3.1 ENV PATH /usr/lib/apache/maven/3.3.1/bin:$PATH USER root RUN export DEBIAN_FRONTEND=noninteractive && apt-get update RUN mkdir -p $MAVEN_HOME && cd $MAVEN_HOME && wget http://mirrors.ibiblio.org/apache/maven/maven- 3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz && tar -zxvf apache-maven-3.3.1-bin.tar.gz && mv apache-maven-3.3.1/* . && rm -rf apache-maven-3.3.1 USER jenkins • Extend the official docker Jenkins file to install Maven • Official Image • https://registry.hub.docker.com/_/jenkins/ • Extended Image • https://github.com/torrances/docker/tree/master/jenkins
  • 3. Build and Launch • Build the docker image • “craig/jenkins“ • Launch a container • Expose on port 8040 (arbitrary) • -p 8040:8080 • Inject a host directory • This will contain all the Jenkins customizations: build configurations, credentials, workspace and built artifacts • Around 130 MB immediately, and can become very large over time • -v ~/jpr:/var/jenkins_home • Code is on the next page • I like to use a shell script that handles any host system manipulation and then calls a docker-compose script Docker (and docker-compose) installation script: https://github.com/torrances/bash/blob/master/install/docker.sh
  • 4. Build and Launch docker-compose.yml jenkins: build: . ports: - "8040:8080" volumes: - ~/jpr:/var/jenkins_home hostname: jenkins privileged: false run.sh mkdir ~/jpr sudo docker-compose up
  • 5. View • Pull up a web browser! Further Configuration (creating new jobs): http://trimc-devops.blogspot.com/p/masterpage.html#jenkins
  • 7. Add Maven Installation • Click on Configure System
  • 8. Add Maven Installation • Scroll down • Click the Add Maven button • Unselect the Install automatically checkbox • In the Name textbox, put maven • In the MAVEN_HOME textbox, enter the path from the Dockerfile (/usr/lib/apache/maven/3.3.1) • Click Save Maven Installation and Usage: http://trimc-devops.blogspot.com/p/masterpage.html#maven
  • 9. Install the Git Plugin • Go back to the dashboard • Select Manage Jenkins from the left-hand nav • Select Manage Plugins from the list
  • 10. Install the Git Plugin • Click on the Available tab • Type github in the Filter text area
  • 11. Install the Git Plugin • Scroll down and select Github Plugin • Click Install without restart
  • 12. Install the Git Plugin • Wait for the installation to complete
  • 13. Install the Git Plugin • Wait for the installation to complete
  • 14. Install the Git Plugin • Once the installation is complete, check the Restart Jenkins when installation is complete and no jobs are running checkbox
  • 15. Install the Git Plugin • This will immediately restart Jenkins
  • 17. Things that I haven’t got around to doing yet … • Look into the use of a docker host to dynamically provision a slave, run a single build, and tear down the host: • https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin • Install plugins (like Git) dynamically • https://registry.hub.docker.com/_/jenkins/ • Do I need to install Maven on Docker first, or can this be installed automatically when Jenkins initializes?