Socket
Socket
Sign inDemoInstall

@codedependant/semantic-release-docker

Package Overview
Dependencies
527
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @codedependant/semantic-release-docker

docker package


Version published
Weekly downloads
6.1K
decreased by-6.52%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@codedependant/semantic-release-docker

semantic-release MIT license

A semantic-release plugin to use semantic versioning for docker images.

Supported Steps

verifyConditions

verifies that environment variables for authentication via username and password are set. It uses a registry server provided via config or environment variable (preferred) or defaults to docker hub if none is given. It also verifies that the credentials are correct by logging in to the given registry.

prepare

builds a an image using the specified docker file and context. This image will be used to create tags in later steps

publish

pushes the tags Images with specified tags and pushes them to the registry. Tags support simple templating. Values enclosed in braces {} will be subsititued with release context information

Installation

Run npm i --save-dev @codedependant/semantic-release-docker to install this semantic-release plugin.

Configuration

Docker registry authentication

The docker registry authentication set via environment variables. It is not required, and if omitted, it is assumed the docker daemon is already authenticated with the targe registry.

Environment variables

VariableDescription
DOCKER_REGISTRY_USERThe user name to authenticate with at the registry.
DOCKER_REGISTRY_PASSWORDThe password used for authentication at the registry.

Options

OptionDescriptionDefault
docker.tagsOptional. An array of strings allowing to specify additional tags to apply to the image.[latest, {major}-latest, {version}]
docker.imageOptional. The name of the image to release.Parsed from package.json name property
docker.registryOptional. The hostname and port used by the the registry in format hostname[:port]. Omit the port if the registry uses the default portnull (dockerhub)
docker.projectOptional. The project or repository name to publish the image toFor scoped packages, the scope will be used, otherwise null
docker.dockerfileOptional. The path, relative to $PWD to a Docker file to build the target image withDockerfile
docker.contextOptional. A path, relative to $PWD to use as the build context A.

Usage

full configuration:

{
  "release": {
    "plugins": [
      ["@codedependant/semantic-release-docker", {
        "docker": {
          "tags": ["latest", "{version}", "{major}-latest", "{major}.{minor}"],
          "image": "my-image",
          "dockerfile": "Dockerfile",
          "registry": "quay.io",
          "project": "codedependant"
        }
      }]
    ]
  }
}

results in quay.io/codedependant/my-image with tags latest, 1.0.0, 1-latest and the 1.0 determined by semantic-release.

Alternatively, using global options w/ root configuration

{
  "release": {
    "extends": "@internal/release-config-example",
    "docker": {
      "tags": ["latest", "{version}", "{major}-latest", "{major}.{minor}"],
      "image": "my-image",
      "dockerfile": "Dockerfile",
      "registry": "quay.io",
      "project": "codedependant"
    }
  }
}

minimum configuration:

{
  "release": {
    "plugins": [
      "@codedependant/semantic-release-docker"
    ]
  }
}
  • A package name @codedependant/test-project results in codedependant/test-project
  • A package name test-project results in test-project

the default docker image tags for the 1.0.0 release would be 1.0.0, 1-latest, latest

Development

Docker Registry

To be able to push to the local registry with auth credentials, ssl certificates are required. This project uses self signed certs. To regenerate the certs run the following:

$ openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt

NOTE: When prompted for an FQDN it must be registry:5000 NOTE: The credentials for the local registry are user: iamweasel, pass: secretsquirrel

Keywords

FAQs

Last updated on 05 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc