- Build a simple Node JS app
- Create a Docker image
- Push the image to Docker Hub
- Start a Jenkins Docker container and configure plugins
- Link your repository to the container using Ngrok
- Create the pipeline
- Add a step to deploy on K8S on somewhere else
This also makes your local Docker usable by the container without having to install it.
$ docker run -it -u root -d \
-p 8080:8080 \
-p 50000:50000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/bin/docker:/usr/bin/docker \
-v /var/jenkins_home:/var/jenkins_home \
--name jenkins jenkins/jenkins:lts
This creates a tunnel between your local Jenkins container and internet so that GitHub can push events when new commits arrive.
$ docker run --rm -it --name ngrok --link jenkins shkoliar/ngrok http jenkins:8080
On GitHub, add a webhook attached to your repository <your url here>/github-webhook/
.