https://github.com/umd-lib/boathook
Rake tasks for managing an application's Docker images
https://github.com/umd-lib/boathook
Last synced: 8 months ago
JSON representation
Rake tasks for managing an application's Docker images
- Host: GitHub
- URL: https://github.com/umd-lib/boathook
- Owner: umd-lib
- License: apache-2.0
- Created: 2022-04-22T17:43:30.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-07T13:55:43.000Z (about 4 years ago)
- Last Synced: 2025-02-27T12:42:07.383Z (over 1 year ago)
- Language: Ruby
- Size: 11.7 KB
- Stars: 0
- Watchers: 11
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# boathook
Rake tasks for managing an application's Docker images
## Quick Start
### Installation
In your `Gemfile`:
```ruby
gem 'boathook', git: 'https://github.com/umd-lib/boathook', tag: 'main'
```
Then run `bundle install`.
### Usage
In your `Rakefile` or `*.rake` task file:
```ruby
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:
```bash
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](LICENSE) file for license rights and limitations (Apache 2.0).
[jq]: https://stedolan.github.io/jq/
[Mattock]: https://rubygems.org/gems/mattock
[Rake]: https://ruby.github.io/rake/
[Boathook]: https://github.com/umd-lib/boathook