Git Product home page Git Product logo

jenkins-docker-boilerplate's Introduction

Jenkins Boilerplate

Link to blog post

Blog Post

This project contains a Makefile which allows you to spin up a docker Jenkins image

Running the project

  • make build
  • make run
  • http://[YOUR_DOMAIN]:8888/

Allow server to talk to docker hub to get image

  • ssh into server
  • sudo usermod -aG docker $USER
  • sudo reboot

Get Container Logs

  • ssh into server
  • docker ps -a (get container id)
  • docker logs --tail 2500 container-id

On initial running of the container

  • check logs and get the admin password
  • once wizard install is over go to manage plugins and install 'build pipeline'

SSH - allow Jenkins to talk to bit bucket

  • ssh into server -> ssh-keygen
  • copy private key paste into Jenkins credential ( cat /var/www/vhosts/[YOUR_DOMAIN]/.ssh/id_rsa )
  • copy public key paste into your bitbucket repo ( cat /var/www/vhosts/[YOUR_DOMAIN]/.ssh/id_rsa.pub )
  • in Jenkins pipeline config select the credential you just created in Jenkins

Create pipeline job

  • create jenkins multibranch pipeline job
  • link to git repo , use ssh key added in credentials
  • Under build configuration select Jenkinsfile

Allow Jenkins to run the pipeline

  • add node plugin in global tools,
  • select a version of node and set the name like this: node-12-3-1
  • in Jenkinsfile reference the name you gave above like this: tools {nodejs "node-12-13-1"}

Trigger build after a commit (jenkins web hook )

On Jenkins

  • install ‘bitbucket' plugin in jenkin
  • create jenkins freestyle project
  • under Source Code Management > connect to bitbucket git rep
  • under Build Triggers > select Build when a change is pushed to BitBucke
  • under Build > select pipeline job to be triggered

On Bitbucket

  • go to repo select > settings > web hooks
  • give a title then give a url of : http://[YOUR_DOMAIN]:8888/bitbucket-hook/
  • select > trigger on repository push

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.