Skip to content

Rake tasks for managing an application's Docker images

License

Notifications You must be signed in to change notification settings

umd-lib/boathook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boathook

Rake tasks for managing an application's Docker images

Quick Start

Installation

In your Gemfile:

gem 'boathook', git: 'https://github.com/umd-lib/boathook', tag: 'main'

Then run bundle install.

Usage

In your Rakefile or *.rake task file:

require 'boathook'

namespace :docker do
  Boathook::DockerTasks.new do |t|
    t.version = 'app-version'
    t.image_specs = [
      {
        name: 'image-name',
        dockerfile: 'path/to/Dockerfile',  # defaults to 'Dockerfile'
        context: 'path/to/context/dir'     # defaults to '.'
      }
      # if your project has multiple Docker images to build, you can add
      # additional image specs here
    ]
  end
end

Now there are three tasks added to your project:

  • docker:tags shows you the full Docker name:tag value for each image it will build
  • docker:build builds the Docker images
  • docker:push push the images to a remote repository

Tags and Labels

If the version includes the string "dev", the tag will be "latest". Otherwise, it will be the value of version.

In addition to tagging the image with the version, docker:build also applies the following labels to the newly created image:

  • org.opencontainer.images.version is the version as given in the constructor block
  • org.opencontainer.images.revision is the current git revision of the project, as determined by running git rev-parse HEAD in the working directory

If you have jq installed, you can easily verify these labels by running:

docker image inspect image-name:tag | jq '.[].Config.Labels'

The Name

This library is built on top of Mattock, which itself is built on top of Rake. Combine these with the fact that Docker is heavily nautically themed, and you get: Boathook!

License

See the LICENSE file for license rights and limitations (Apache 2.0).

About

Rake tasks for managing an application's Docker images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages