GithubHelp home page GithubHelp logo

docker-build-publish-plugin's Introduction

Docker registry build plugin for Jenkins

Build Status

If you want to build and push your Docker based project to the docker registry (including private repos), then you are in luck! This is an early version - tweet @michaelneale if you have questions.

Features:

  • Only a Dockerfile needed to build your project
  • Publish to docker index/registry
  • nocache option (for rebuild of all Dockerfile steps)
  • publish option
  • manage registry credentials for private and public repos
  • tag the image built - use any Jenkins env. variables.

Dockerfile as build config

A Dockerfile is a convenient way to express build instructions.

As the Beatles sang, all you need is Dockerfile, and love. If you have a Dockerfile in the root of your project, then no further configuration is needed.

Usage

Firstly, ensure you have docker running (if you are running with a slave, ensure the slave can run docker) - and that Jenkins can run docker commands.

Setup a build of any type - with a build step that uses Docker: build instructions The usual docker build caching mechanism applies - and you can choose to publish, or not, the resultant image.

Set your credentials (username, email, password) in Manage Jenkins - these are used to access index.docker.io, this includes private repositories:

build config Your credentials are needed if you wish to push (to public or private repos) - or need to build based on a private repo.

Builds will be decorated with the repository name (and tag) of the build images: build decoration

You can supply multiple tags for an image separated by commas. The latest tag is automatically applied to image - if you do not want this check the Do not tag this build as latest checkbox.

Why use a Dockerfile

Defining your build as a Dockerfile means that it will run in a consistent linux environment, no matter where the build is run. You also end up with an image (in a repository, possibly pushed to a registry) that can then be deployed - the exact same image you built.

Dockerfiles can also help speed up builds. If there has been no change relative to a build instruction in the Dockerfile - then a cached version of that portion of the build can be used (this is a fundamental feature of docker)

Terminology

Docker has some confusing terminology - quick refresher:

  • Repository - collection of docker images and tags. You "push" a repository to a registry, and when you build an image, it gets added to a repository. By default this is the "latest" version (tag)
  • Registry - a place you push docker images/repos to
  • Push - deploy a docker repo (presumably with a new image) to a remote registry
  • Image - a docker image is what you build from a Dockerfile - it gets added to a repo

Plugin development

Environment

The following build environment is required to build this plugin

  • java-1.6 and maven-3.0.5

Build

To build the plugin locally:

mvn clean verify

Release

To release the plugin:

mvn release:prepare release:perform -B

Test local instance

To test in a local Jenkins instance

mvn hpi:run

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.