Giter Club home page Giter Club logo

docker-builder's Introduction

Docker builder

A Python application which manages Docker containers. It adds support to automatically detect up- & downstream images, build those images and push them to a Docker repository. This eases the use of automated CI / CD which needs custom images.

Installation

This application should be run with Python >= 3.5 so create a venv with the correct Python version after downloading and run pip install . (or pip install -e . when developing). You can now run the docker-builder command to start building and pushing containers. When pushing to registries, please make sure you're logged in to them.

Configuration

The builder supports default configuration from a .Dockerbuild file. This should be located in the user's home directory (~/.Dockerbuild) and it should be in INI format. The following config options exist:

[core]
    push = Bool <False> (Whether to push images to an external registry after they're build) 

[logging]
    level = String <info> (The logging level, can be debug or info)
    
[registries] (Array of registries to push images to after they're build)
registry[] = registry-one 
registry[] = registry-two
...

[directories] (Array of directories which contain Dockerfiles for the images. The directories are traversed recursive)
directory[] = /path/to/images
directory[] = /path/to/more/images
...

You can also pass configuration options to the CLI which take precedence over the default configuration. To learn more about these options, run docker-builder -h.

Docker containers

The application will scan Dockerfiles in the configured directories, determine the dependency order and build the images in the resolve order. You can pass additional data to the docker build & docker push operations by providing a manifest.json file in the same directory as where the Dockerfile resides. Options for the manifest.json file are:

  • "local_tag": "image:version" (The tag used for the image the local Docker repository. When this is not present, the image will not be tagged)
  • "registry_tag": "image:other-version" (The tag used for the image in the registries. If this tag is not present, the image will not be pushed)
  • "arguments": {} (Arguments that are passed to the docker build command. These options are supported)
  • "pre_build": [] (Commands that are executed before the image is build)
  • "post_build": [] (Commands that are executed after the image is build)

A manifest.json file could look like this:

{
  "local_tag": "acme-container:1.0",
  "registry_tag": "container:latest",
  "arguments": {
    "--no-cache": true,
    "--label": "Some label",
    "--build-arg": [
      "FOO=BAR",
      "BAD=GOOD"
    ]
  },
  "pre_build": [
    "git clone repo"
  ],
  "post_build": [
    "rm -rf repo"
  ]
}

docker-builder's People

Contributors

leonkoens avatar sjadema avatar avanheuvelen avatar

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.