Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Continuous Deployment using Jenkins and Docker Workflow

All instructions and resources are in attendees/cicd directory.

Note
Change IP address to the Docker host where Git server is running.

Configure Docker Machine

  1. Enable Docker commands in Jenkins docker-machine ssh <MACHINE_NAME> "sudo chmod 777 /var/run/docker.sock"

Start Services

Start all services in detached mode by giving the command:

docker-compose up -d

This shows the output:

Creating git_serverdata...
Creating cicd_registry_1...
Creating cicd_jenkins_1...
Creating cicd_git_dbdata_1...
Creating cicd_git_db_1...
Creating git...

The exact output will differ as all the images may be downloaded.

Setup Gogs server

  1. Configure Gogs server by executing the script:

    ./install-gogs.sh <DOCKER_HOST_IP> <git_server_PORT>

    For example: ./install-gogs.sh 192.168.99.100 3000

    This brings up the page http://<DOCKER_HOST_IP>:3000/user/sign_up in your default browser.

  2. Create an account and login using the credentials

  3. Create a new repository javaee7-docker-workflow (take all defaults)

  4. In a shell:

    git clone https://github.com/arun-gupta/javaee7-docker-workflow
    cd javaee7-docker-workflow
    git remote add gogs http://192.168.99.100:3000/arun/javaee7-docker-workflow.git
    git push gogs master

    This workspace is a Java EE sample that has Arquillian tests and can be packaged as a Docker image.

Jenkins

  1. Access Jenkins at http://192.168.99.100:8084

  2. Create a new workflow and use “Workflow script from SCM”.

  3. Use the “Repository URL” as “https://github.com/arun-gupta/javaee7-docker-workflow”; and “Script Path” as “Jenkinsfile”.

  4. Start a build

Current Status

  1. Checks out the application workspace from Gogs server

  2. Builds the application

  3. Runs the test (using mvn test -Pwildfly-managed)

  4. Creates a Docker image for the application (mvn package -Pdocker -DskipTests)