Giter VIP home page Giter VIP logo

circle-docker's Introduction

circle-docker

A helper for building with Docker on CircleCI.

Once set up, this will cache builds, tag them with branch and build details, and push them to a registry.

You end up with builds like myapp:latest-master for the latest rolling build and myapp:master-42 for a specific Circle CI build number.

Optionally, circle-docker can be configured to send progress notifications via Slack.

Setup

Your CircleCI project environment should be configured with these environment variables:

  • DOCKER_REGISTRY - the URL to your registry
  • DOCKER_USER - the username for your registry login
  • DOCKER_PASSWORD - the password for your registry login
  • DOCKER_EMAIL - the email address associated with your login

If you try to use circle-docker without these set, you'll receive a warning informing you of what's missing.

Set up your circle.yml with machine dependencies like so:

machine:
  pre:
  - |
    sudo curl -L -o /usr/bin/circle-docker 'https://raw.githubusercontent.com/barricadeio/circle-docker/v0.2.0/circle-docker.sh'
    sudo chmod 0755 /usr/bin/circle-docker
  services:
    - docker

This will set up your build envrionment with the circle-docker command.

Also, dependencies should include a cache_directories section:

dependencies:
  cache_directories:
    - "~/docker"

Usage

Building

You'll need to stick an override in dependencies so that images can be cached:

dependencies:
  override:
    - circle-docker env
    - circle-docker cached_build myapp

The circle-docker env command outputs some debug information about Docker (not required, just useful).

Pushing

To push, use deployment hooks, e.g.,:

deployment:
  production:
    branch: production
    commands:
      - circle-docker push myapp
  testing:
    branch: master
    commands:
      - circle-docker push myapp

Slack Integration

You can optionally configure Slack notifications for build progress via webhooks.

To do so, set an environment variable called SLACK_WEBHOOK in your project environment with the webhook URL. You can read more about Slack webhooks here.

By default, this will send notifications to your #general channel. This can be overridden by setting a SLACK_CHANNEL environment variable.

When set up, you get notifications when a build has started, when it's begun pushing, and when it has completed:

Example of Slack notifications

circle-docker's People

Contributors

duggan avatar

Watchers

 avatar  avatar  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.