{
    "componentChunkName": "component---src-templates-post-js",
    "path": "/pensieve/custom-jenkins-images-with-plugins-pre-installed-1pok",
    "result": {"data":{"markdownRemark":{"html":"<p><img src=\"https://www.sohamkamani.com/static/18122218f0260b8206bc3bb69197ba7e/8ff1e/logo.png\" alt=\"Draft fail\"></p>\n<hr>\n<p>title:\npublished: true\ndescription:\ntags: jenkins,ci/cd,devops\ncover<em>image: <a href=\"https://miro.medium.com/max/3200/1*n7ba3rjWYs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://miro.medium.com/max/3200/1*n7ba3rjWYs</a></em>lZeYbKogKdw.jpeg</p>\n<hr>\n<p>If you are doing continous delivery or continous integration, you may frequntly run into jenkins.\nJenkins is a core part of our Continuous Integration and Continuous Deployment (CI/CD) pipeline. Here are the top 3 reasons we love Jenkins:</p>\n<ul>\n<li>It is an open system that is platform, language, and methodology agnostic allowing us to support our diverse client base with one non-proprietary CI/CD platform.</li>\n<li>It is the industry reference implementation for what a CI / CD system should be with a rich ecosystem of more than 1,100 plug-ins has emerged, enabling customers to add all sorts of functionality and integrate Jenkins with everything from Active Directory to GitHub to the OpenShift PaaS</li>\n<li>It is focused on CI/CD, and is not trying to be what it is not (Git repository, Chat client, Docker storage, etc.)\nThe beauty of using Jenkins is that you are not locked into any proprietary vendor. It has major support in the industry and many engineers are already familiar with it.</li>\n<li>Plus it offers plethora of features out of the box so you don't have to\nsearch google for hacks</li>\n</ul>\n<p>However one thing that has been a pain over period of using jenkins was the initial setup mostly during plugins installation. I mean this:</p>\n<p><img src=\"https://i.imgur.com/i09ODkv.png\"></p>\n<p><img src=\"https://media.giphy.com/media/VbnUQpnihPSIgIXuZv/giphy.gif\"></p>\n<p>So I wrote a custom jenkins image with all the plugins pre-installed,a default user, docker and docker-compose installed for people who want to use it without the hassle of configuring</p>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token instruction\"><span class=\"token keyword\">FROM</span> jenkins/jenkins</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JENKINS_USER admin</span>\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JENKINS_PASS admin</span>\n\n<span class=\"token comment\"># Skip initial setup</span>\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JAVA_OPTS -Djenkins.install.runSetupWizard=false</span>\n\n\n<span class=\"token instruction\"><span class=\"token keyword\">COPY</span> plugins.txt /usr/share/jenkins/plugins.txt</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/plugins.txt</span>\n<span class=\"token instruction\"><span class=\"token keyword\">USER</span> root</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apt-get update <span class=\"token operator\">\\</span>\n    &amp;&amp; apt-get install -qqy apt-transport-https ca-certificates curl gnupg2 software-properties-common</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> add-apt-repository <span class=\"token operator\">\\</span>\n   <span class=\"token string\">\"deb [arch=amd64] https://download.docker.com/linux/debian \\\n   $(lsb_release -cs) \\\n   stable\"</span></span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apt-get update  -qq <span class=\"token operator\">\\</span>\n    &amp;&amp; apt-get install docker-ce -y</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> usermod -aG docker jenkins</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apt-get clean</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> curl -L <span class=\"token string\">\"https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)\"</span> -o /usr/local/bin/docker-compose &amp;&amp; chmod +x /usr/local/bin/docker-compose</span>\n<span class=\"token instruction\"><span class=\"token keyword\">USER</span> jenkins</span></code></pre></div>\n<p>Worrying about image size? Don't worry I got you covered. I also happen to write another alpine image for people who are space conservative :D</p>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token instruction\"><span class=\"token keyword\">FROM</span> jenkins/jenkins:alpine</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JENKINS_USER admin</span>\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JENKINS_PASS admin</span>\n\n<span class=\"token comment\"># Skip initial setup</span>\n<span class=\"token instruction\"><span class=\"token keyword\">ENV</span> JAVA_OPTS -Djenkins.install.runSetupWizard=false</span>\n\n\n<span class=\"token instruction\"><span class=\"token keyword\">COPY</span> plugins.txt /usr/share/jenkins/plugins.txt</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> /usr/local/bin/install-plugins.sh &lt; /usr/share/jenkins/plugins.txt</span>\n<span class=\"token instruction\"><span class=\"token keyword\">USER</span> root</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apk add docker</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apk add py-pip</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apk add python-dev libffi-dev openssl-dev gcc libc-dev make</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> pip install docker-compose</span>\n<span class=\"token instruction\"><span class=\"token keyword\">USER</span> jenkins</span></code></pre></div>\n<p>For full source code and the plugins.txt file , you can checkout my repo at <a href=\"https://github.com/rubiin/jenkins\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/rubiin/jenkins</a></p>\n<blockquote>\n<p>Note: I specially wrote these images for a project where I was using docker-compose to manage my container stack, so feel free to omit the docker and compose setup</p>\n</blockquote>\n<p><img src=\"https://media.giphy.com/media/7XuPYJXaF1CBAmbwQQ/giphy.gif\"></p>","frontmatter":{"title":"Custom jenkins images with plugins pre-installed","description":null,"date":"2019-10-12","slug":"/pensieve/custom-jenkins-images-with-plugins-pre-installed-1pok","tags":["Jenkins","Devops","CI/CD"]}}},"pageContext":{}},
    "staticQueryHashes": ["3115057458"]}