Skip to content

cicdops/docker-jenkins-pipeline

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker + Java + Jenkins Pipeline

Manual Steps

  1. Start database: docker run -d --name db -p 8091-8093:8091-8093 -p 11210:11210 arungupta/oreilly-couchbase:latest

  2. Run app

    1. Using Maven

      1. Build app: mvn -f webapp/pom.xml clean package

      2. Run app: mvn -f webapp/pom.xml exec:java -DskipTests

      3. Run test: mvn -f webapp/pom.xml test

    2. Using Docker

      1. Build app: docker-compose build app

      2. Run app:

        docker-compose run -e DB_URI=`docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db` app
      3. Run test: mvn test

Jenkins

Configure

  1. Download Jenkins, this was tested with 2.21[http://mirrors.jenkins-ci.org/war/2.21/jenkins.war].

  2. Start Jenkins: JENKINS_HOME=~/.jenkins java -jar ~/Downloads/jenkins-2.21.war --httpPort=9090

  3. Create First Admin User, Save and Finish.

  4. Install suggested plugins

  5. Manage Jenkins, Global Tool Configuration, configure Maven, use name Maven3 (this name is used in Jenkinsfile)

  6. Manage Jenkins, Manage Plugins, Available, install CloudBees Docker Pipeline plugin, Install without restart, select Restart Jenkins

Create Project

  1. Create a new project of the type Pipeline

  2. Configure git repo

  3. Build Now

Bintray Configuration

This setup is required if you want to push to bintray repository instead.

Setup Bintray repository

  1. Create Bintray account

  2. Find the following credentials from Profile. These will be used in Jenkins credentials later.

    1. Username

    2. API key

Configure Bintray in Jenkins

  1. Add your credentials using Username and Password, use username and API key from Bintray. Use the name bintray, this is used in Jenkinsfile.

  2. Add Maven installation directory, call it Maven3. This name is used in Jenkinsfile.

  3. Create a new project, use Pipeline Script from SCM

  4. Build the project pushes a Docker image to bintray repo

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%