Public | Automated Build

Last pushed: 3 years ago
Short Description
Jenkins with built-in php tools
Full Description


This Jenkins can be run in a container of a host by mounting the docker.sock

Included PHP tools

Included Plugins

  • checkstyle
  • cloverphp
  • crap4j
  • dry
  • email-ext
  • git-client
  • git
  • github-api
  • github
  • greenballs
  • htmlpublisher
  • jdepend
  • plot
  • pmd
  • postbuild-task
  • postbuildscript
  • scm-api
  • slack
  • violations
  • warnings
  • xunit

Build Image

plugins.txt list the plugins you want to installed in Jenkins.

docker build -t myjenkins .

Run Image

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /home/ubuntu/jenkins_home:/var/jenkins_home -p 8080:8080 myjenkins


docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /home/ubuntu/jenkins_home:/var/jenkins_home -v /home/ubuntu/work:/work -p 8080:8080 --name jenkins myjenkins

Jenkins Job Configuration

  • On the configuration page, click “Add build step” then “Execute shell”.
sudo docker run [Docker Image]
  • Console Output will show the result.

Github and Jenkins

Install Github API plugin and Github plugin.
Reference: plugins.txt

Github webhook

  • Githup repo > Settings > Webhooks & Services > Services > Add service
  • choose Jenkins (GitHub plugin)
  • Jenkins hook url: http://<you jenkins url>:8080/github-webhook/

Jenkins Job Configuration

  • source code management > git
    • input Repository URL
    • Additional Behaviours > Check out to a sub-directory
      for example: $BUILD_NUMBER
      Jenkins will clone source code into $BuildId_NUMBER folder.
  • check Build when a change is pushed to GitHub
  • Add build step > Execute shell
    for example: Mount $BUILD_NUMBER to docker container.

    sudo docker run -v /home/ubuntu/jenkins_home/workspace/docker-test/$BUILD_NUMBER:/test test


  • Security: Jenkins user has root access to the host
Docker Pull Command
Source Repository