Skip to content

Docker Plugin

This plugin automates tagging and publishing images to a docker registry.

Prerequisites

To publish to a docker registry, you'll first need to authenticate with the target registry. For example, the Docker Login Action for GitHub, or the withRegistry helper in Jenkins.

Installation

This plugin is not included with the auto CLI installed via NPM. To install:

npm i --save-dev @auto-it/docker
# or
yarn add -D @auto-it/docker
npm i --save-dev @auto-it/docker
# or
yarn add -D @auto-it/docker

Usage

You must first must build the desired image to publish.

These environment variables tell auto what to publish.

  • IMAGE - The image ID, digest, or tag of the locally available image to tag and publish. This is required unless you want to statically tag the local image, in which case you can provide it as an option.
{
  "plugins": [
    ["docker", { "registry": "ghcr.io/my/app" }]
    // other plugins
  ]
}
{
  "plugins": [
    ["docker", { "registry": "ghcr.io/my/app" }]
    // other plugins
  ]
}

If you'd like to tag releases with latest too, you can specify the tagLatest option:

{
  "plugins": [["docker", { "registry": "ghcr.io/my/app", "tagLatest": true }]]
}
{
  "plugins": [["docker", { "registry": "ghcr.io/my/app", "tagLatest": true }]]
}

If you're tagging the locally built image in a static manner, you can also pass image instead of IMAGE as an environment variable.

{
  "plugins": [["docker", { "registry": "ghcr.io/my/app", "image": "myapp" }]]
}
{
  "plugins": [["docker", { "registry": "ghcr.io/my/app", "image": "myapp" }]]
}