/pipline

docker, jenkins and java pipeline

Primary LanguageJavaMIT LicenseMIT

docker-jenkins-java-pipeline

Manual Steps

  1. Start database: docker run -d --name db -p 8091-8093:8091-8093 -p 11210:11210 moaaztaha/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