{"_id":"@3o2/semantic-release-docker","_rev":"1-1751e28b17ac6afd750427a06e828601","name":"@3o2/semantic-release-docker","dist-tags":{"latest":"1.2.2"},"versions":{"1.2.1":{"name":"@3o2/semantic-release-docker","private":false,"version":"1.2.1","description":"docker package","main":"index.js","scripts":{"test":"docker-compose -f compose/base.yml -f compose/test.yml up --exit-code-from semantic-release --force-recreate --remove-orphans --build","start":"docker-compose -f compose/base.yml -f compose/dev.yml up --force-recreate --remove-orphans --build","stop":"docker-compose -f compose/base.yml -f compose/dev.yml down","tap":"tap","lint":"eslint .","lint:fix":"npm run lint -- --fix","local":"env $(cat env/local.env)","pretap":"npm run lint","release":"semantic-release"},"keywords":["semantic-release"],"author":{"name":"Eric Satterwhite","email":"esatterwhite@wi.rr.com"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/logikaljay/semantic-release-docker.git"},"tap":{"ts":false,"jsx":false,"timeout":60,"browser":false,"check-coverage":true,"lines":95,"branches":95,"statements":95,"functions":95,"files":["test/unit","test/integration"],"coverage-report":["text","text-summary","json","json-summary","html"],"nyc-arg":["--exclude=coverage/","--exclude=test/","--exclude=.eslintrc.js","--exclude=release.config.js","--all"]},"devDependencies":{"@codedependant/release-config-npm":"^1.0.4","@semantic-release/changelog":"^5.0.1","@semantic-release/git":"^9.0.0","@semantic-release/github":"^7.0.7","eslint":"^8.5.0","eslint-config-codedependant":"^3.0.0","semantic-release":"17","sinon":"^9.0.2","tap":"^16.0.0"},"dependencies":{"@semantic-release/error":"^3.0.0","debug":"^4.1.1","execa":"^4.0.2","handlebars":"^4.7.7","semver":"^7.3.2"},"publishConfig":{"access":"public"},"gitHead":"57d5fc294268180431e1f20c0124fcde3cf7a46e","bugs":{"url":"https://github.com/logikaljay/semantic-release-docker/issues"},"homepage":"https://github.com/logikaljay/semantic-release-docker#readme","_id":"@3o2/semantic-release-docker@1.2.1","_nodeVersion":"12.22.12","_npmVersion":"7.24.2","dist":{"integrity":"sha512-k2GMFpo0lylRwY8ZQHDqLImQH+EDZzxsPhytLZK7OuRo1gOXaFh8lodiO57ol+EuBdZxPcKOVkH31k3x9iB4yw==","shasum":"9c097ba45fd4bca2ff19d08bf181412175b17676","tarball":"https://registry.npmjs.org/@3o2/semantic-release-docker/-/semantic-release-docker-1.2.1.tgz","fileCount":40,"unpackedSize":58509,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9nkKgHrhoq02qP0LN+4oj5US//CzCpe2VnlZIVhcAuAIgKjJsvUAs7gMjNtl+rC/qSb5H6Rw1NpgGjNMqpgRwVJw="}]},"_npmUser":{"name":"logikaljay","email":"logikal@gmail.com"},"directories":{},"maintainers":[{"name":"logikaljay","email":"logikal@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semantic-release-docker_1.2.1_1685055313640_0.8830696148097836"},"_hasShrinkwrap":false},"1.2.2":{"name":"@3o2/semantic-release-docker","private":false,"version":"1.2.2","description":"docker package","main":"index.js","scripts":{"test":"docker-compose -f compose/base.yml -f compose/test.yml up --exit-code-from semantic-release --force-recreate --remove-orphans --build","start":"docker-compose -f compose/base.yml -f compose/dev.yml up --force-recreate --remove-orphans --build","stop":"docker-compose -f compose/base.yml -f compose/dev.yml down","tap":"tap","lint":"eslint .","lint:fix":"npm run lint -- --fix","local":"env $(cat env/local.env)","pretap":"npm run lint","release":"semantic-release"},"keywords":["semantic-release"],"author":{"name":"Eric Satterwhite","email":"esatterwhite@wi.rr.com"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/logikaljay/semantic-release-docker.git"},"tap":{"ts":false,"jsx":false,"timeout":60,"browser":false,"check-coverage":true,"lines":95,"branches":95,"statements":95,"functions":95,"files":["test/unit","test/integration"],"coverage-report":["text","text-summary","json","json-summary","html"],"nyc-arg":["--exclude=coverage/","--exclude=test/","--exclude=.eslintrc.js","--exclude=release.config.js","--all"]},"devDependencies":{"@codedependant/release-config-npm":"^1.0.4","@semantic-release/changelog":"^5.0.1","@semantic-release/git":"^9.0.0","@semantic-release/github":"^7.0.7","eslint":"^8.5.0","eslint-config-codedependant":"^3.0.0","semantic-release":"17","sinon":"^9.0.2","tap":"^16.0.0"},"dependencies":{"@semantic-release/error":"^3.0.0","debug":"^4.1.1","execa":"^4.0.2","handlebars":"^4.7.7","semver":"^7.3.2"},"publishConfig":{"access":"public"},"gitHead":"ee7786e0ffd10bb7046c3a21702b3010c7407163","bugs":{"url":"https://github.com/logikaljay/semantic-release-docker/issues"},"homepage":"https://github.com/logikaljay/semantic-release-docker#readme","_id":"@3o2/semantic-release-docker@1.2.2","_nodeVersion":"12.22.12","_npmVersion":"7.24.2","dist":{"integrity":"sha512-n6NGESbAvLos9HCuHGMydyLSQEkMy2a/xrjAkjLH0kECmlCQLBWaeJqev+Ky2L8Zksy8L84yQ48pl0eQRo+duA==","shasum":"73d0e14318c14c00262a0ebf763acb2c69a2a1a1","tarball":"https://registry.npmjs.org/@3o2/semantic-release-docker/-/semantic-release-docker-1.2.2.tgz","fileCount":40,"unpackedSize":59031,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwqRKYk+ZOuAWeQZnqOAlmy4YDqgld2eIiAEHSKpazBwIgLgN1YyJaB1+rGojvghJ1jV9DcpGBHL2RgqFjk5dwyIM="}]},"_npmUser":{"name":"logikaljay","email":"logikal@gmail.com"},"directories":{},"maintainers":[{"name":"logikaljay","email":"logikal@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semantic-release-docker_1.2.2_1685055819239_0.40494448121677085"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-25T22:55:13.587Z","1.2.1":"2023-05-25T22:55:13.830Z","modified":"2023-05-25T23:03:39.568Z","1.2.2":"2023-05-25T23:03:39.456Z"},"maintainers":[{"name":"logikaljay","email":"logikal@gmail.com"}],"description":"docker package","homepage":"https://github.com/logikaljay/semantic-release-docker#readme","keywords":["semantic-release"],"repository":{"type":"git","url":"git+ssh://git@github.com/logikaljay/semantic-release-docker.git"},"author":{"name":"Eric Satterwhite","email":"esatterwhite@wi.rr.com"},"bugs":{"url":"https://github.com/logikaljay/semantic-release-docker/issues"},"license":"MIT","readme":"# @codedependant/semantic-release-docker\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![MIT license](https://img.shields.io/npm/l/@codedependant/semantic-release-docker.svg)](https://www.npmjs.com/package/@codedependant/semantic-release-docker)\n\nA [semantic-release](https://github.com/semantic-release/semantic-release) plugin to use semantic versioning for docker images.\n\n## Supported Steps\n\n### verifyConditions\n\nverifies that environment variables for authentication via username and password are set.\nIt uses a registry server provided via config or environment variable (preferred) or defaults to docker hub if none is given.\nIt also verifies that the credentials are correct by logging in to the given registry.\n\n### prepare\n\nbuilds a an image using the specified docker file and context. This image will be used to create tags in later steps\n\n### publish\n\npushes the tags Images with specified tags and pushes them to the registry.\nTags support simple templating via [handlebars][]. Values enclosed in braces `{{}}` will be substituted with release context information\n\n## Installation\n\nRun `npm i --save-dev @codedependant/semantic-release-docker` to install this semantic-release plugin.\n\n## Configuration\n\n### Docker registry authentication\n\nThe `docker registry` authentication set via environment variables. It is not required, and if\nomitted, it is assumed the docker daemon is already authenticated with the target registry.\n\n### Environment variables\n\n| Variable                 | Description                                                                               |\n| ------------------------ | ----------------------------------------------------------------------------------------- |\n| DOCKER_REGISTRY_USER     | The user name to authenticate with at the registry.                                       |\n| DOCKER_REGISTRY_PASSWORD | The password used for authentication at the registry.                                     |\n\n### Options\n\n| Option            | Description                                                                                                                                                            | Type                        | Default                                                       |\n|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|---------------------------------------------------------------|\n| `dockerTags`      | _Optional_. An array of strings allowing to specify additional tags to apply to the image. Supports templating                                                         | [Array][]&lt;[String][]&gt; | [`latest`, `{{major}}-latest`, `{{version}}`]                 |\n| `dockerImage`     | _Optional_. The name of the image to release.                                                                                                                          | [String][]                  | Parsed from package.json `name` property                      |\n| `dockerRegistry`  | _Optional_. The hostname and port used by the the registry in format `hostname[:port]`. Omit the port if the registry uses the default port                            | [String][]                  | `null` (dockerhub)                                            |\n| `dockerProject`   | _Optional_. The project or repository name to publish the image to                                                                                                     | [String][]                  | For scoped packages, the scope will be used, otherwise `null` |\n| `dockerFile`      | _Optional_. The path, relative to `$PWD` to a Docker file to build the target image with                                                                               | [String][]                  | `Dockerfile`                                                  |\n| `dockerContext`   | _Optional_. A path, relative to `$PWD` to use as the build context A                                                                                                   | [String][]                  | `.`                                                           |\n| `dockerLogin`     | _Optional_. Set to false it by pass docker login if the docker daemon is already authorized                                                                            | [String][]                  | `true`                                                        |\n| `dockerArgs`      | _Optional_. Include additional values for docker's `build-arg`. Supports templating                                                                                    | [Object][]                  |                                                               |\n| `dockerPublish`   | _Optional_. Automatically push image tags during the publish phase.                                                                                                    | [Boolean][]                 | `true`                                                        |\n| `dockerVerifyCmd` | _Optional_. If specified, during the verify stage, the specified command will execute in a container of the build image. If the command errors, the release will fail. | [String][]                  | `false`                                                       |\n| `dockerNetwork`   | _Optional_. Specify the Docker network to use while the image is building.                                                                                             | [String][]                  | `default`                                                     |\n| `dockerAutoClean` | _Optional_. If set to true                                                                                                                                             | [Boolean][]                 | `true`                                                        |\n| `dockerPlatform`  | _Optional_. Specify the platforms to build for.                                                                                                                        | [Array][]&lt;[String][]&gt; |                                                               |\n\n### Build Arguments\n\nBy default several build arguments will be included when the docker images is being built.\nBuild arguments can be templated in the same fashion as docker tags. If the value for a\nbuild argument is explicitly `true`, the value will be omitted and the value from\na matching environment variable will be utilized instead. This can be useful when trying to include\nsecrets and other sensitive information\n\n| Argument Name       | Description                                                                               | Default                      |\n|---------------------|-------------------------------------------------------------------------------------------|------------------------------|\n| `SRC_DIRECTORY`     | The of the directory the build was triggered from                                         | The directory name of CWD    |\n| `TARGET_PATH`       | Path relative to the execution root. Useful for Sharing a Single Docker file in monorepos |                              |\n| `NPM_PACKAGE_NAME`  | The `name` property extracted from `package.json` - if present                            |                              |\n| `NPM_PACKAGE_SCOPE` | The parsed scope from the `name` property from `package.json` - sans `@`                  |                              |\n| `CONFIG_NAME`       | The configured name of the docker image.                                                  | The parsed package name      |\n| `CONFIG_PROJECT`    | The configured docker repo project name                                                   | The package scope if present |\n| `GIT_SHA`           | The commit SHA of the current release                                                     |                              |\n| `GIT_TAG`           | The git tag of the current release                                                        |                              |\n\n### Template Variables\n\nString template will be passed these\n\n| Variable name  | Description                                                        | Type                        |\n|----------------|--------------------------------------------------------------------|-----------------------------|\n| `git_sha`      | The commit SHA of the current release                              | [String][]                  |\n| `git_tag`      | The git tag of the current release                                 | [String][]                  |\n| `release_type` | The severity type of the current build (`major`, `minor`, `patch`) | [String][]                  |\n| `relase_notes` | The release notes blob associated with the release                 | [String][]                  |\n| `next`         | Semver object representing the next release                        | [Object][]                  |\n| `previous`     | Semver object representing the previous release                    | [Object][]                  |\n| `major`        | The major version of the next release                              | [Number][]                  |\n| `minor`        | The minor version of the next release                              | [Number][]                  |\n| `patch`        | The patch version of the next release                              | [Number][]                  |\n| `prerelease`   | The prerelease versions of the next release                        | [Array][]&lt;[Number][]&gt; |\n| `env`          | Environment variables that were set at build time                  | [Object][]                  |\n| `pkg`          | Values parsed from `package.json`                                  | [Object][]                  |\n| `build`        | A Random build hash representing the current execution context     | [String][]                  |\n| `now`          | Current timestamp is ISO 8601 format                               | [String][]                  |\n\n### Template Helpers\n\nThe following handlebars template helpers are pre installed\n\n|  Helper name | Description                                                            | Return Type | Example                                                                                    |\n|:------------:|------------------------------------------------------------------------|:-----------:|--------------------------------------------------------------------------------------------|\n|  `endswith`  | returns true if a string ends with another                             | [Boolean][] | <pre lang=\"hbs\">{{#if (endswith myvar 'ing')}}{{ othervar }}{{/if}}</pre>                  |\n|     `eq`     | returns true if two values are strictly equal to each other            | [Boolean][] | <pre lang=\"hbs\">{{#if (eq var_one var_two)}}{{ var_three }}{{/if}}</pre>                   |\n|     `gt`     | returns true if the first value is greater than the second             | [Boolean][] | <pre lang=\"hbs\">{{#if (gt var_one var_two)}}{{ var_three }}{{/if}}</pre> |\n|     `gte`    | returns true if the first value is greater than or equal to the second | [Boolean][] | <pre lang=\"hbs\">{{#if (gte var_one var_two)}}{{ var_three }}{{/if}}</pre>                  |\n|  `includes`  | returns true if the input (string \\| array) includes the second value  | [Boolean][] | <pre lang=\"hbs\">{{#if (includes some_array 'one')}}{{ var_one }}{{/if}}</pre>              |\n|    `lower`   | returns the lower cased varient of the input string                    |  [String][] | <pre lang=\"hbs\">{{ lower my_var }}</pre>                                                   |\n|     `lt`     | returns true if the first value is less than the second                | [Boolean][] | <pre lang=\"hbs\">{{#if (lt var_one var_two)}}{{ var_three }}{{/if}}</pre>                   |\n|     `lte`    | returns true if the first value is less than or equal to the second    | [Boolean][] | <pre lang=\"hbs\">{{#if (lte var_one var_two)}}{{ var_three }}{{/if}}</pre>                  |\n|     `neq`    | returns true if two values are not equal to each other                 | [Boolean][] | <pre lang=\"hbs\">{{#if (neq var_one var_two)}}{{ var_three }}{{/if}}</pre>                  |\n|    `pick`    | returns the first non null-ish value. Will treat `false` as a value    |    `any`    | <pre lang=\"hbs\">{{#with (pick var_one, var_two) as \\| value \\|}}{{ value }}{{/with}}</pre> |\n|    `split`   | splits csv values into a javascript array                              |  [Array][]  | <pre lang=\"hbs\">{{#each (split csv_value)}}{{ this }}{{/each}}                             |\n| `startswith` | returns true if a string starts with another                           | [Boolean][] | <pre lang=\"hbs\">{{#if (starts myvar 'foo')}}{{ othervar }}{{/if}}</pre>                    |\n|    `upper`   | returns the upper cased varient of the input string                    |  [String][] | <pre lang=\"hbs\">{{upper my_var}}</pre>                                                     |\n\n\n\n## Usage\n\n**full configuration**:\n\n```javascript\n// release.config.js\n\nmodule.exports = {\n  branches: ['main']\n  plugins: [\n    ['@codedependant/semantic-release-docker', {\n      dockerTags: ['latest', '{{version}}', '{{major}}-latest', '{{major}}.{{minor}}'],\n      dockerImage: 'my-image',\n      dockerFile: 'Dockerfile',\n      dockerRegistry: 'quay.io',\n      dockerProject: 'codedependant',\n      dockerArgs: {\n        API_TOKEN: true\n      , RELEASE_DATE: new Date().toISOString()\n      , RELEASE_VERSION: '{{next.version}}'\n      }\n    }]\n  ]\n}\n```\n\nresults in `quay.io/codedependant/my-image` with tags `latest`, `1.0.0`, `1-latest` and the `1.0` determined by `semantic-release`.\n\nAlternatively, using global options w/ root configuration\n```json5\n// package.json\n{\n  \"name\": \"@codedependant/test-project\"\n  \"version\": \"1.0.0\"\n  \"release\": {\n    \"extends\": \"@internal/release-config-docker\",\n    \"dockerTags\": [\"latest\", \"{{version}}\", \"{{major}}-latest\", \"{{major}}.{{minor}}\"],\n    \"dockerImage\": \"my-image\",\n    \"dockerFile\": \"Dockerfile\",\n    \"dockerRegistry\": \"quay.io\",\n    \"dockerArgs\": {\n      \"GITHUB_TOKEN\": true\n    , \"SOME_VALUE\": '{{git_sha}}'\n    }\n  }\n}\n```\n\nThis would generate the following for a `1.2.0` build\n\n```shell\n$ docker build -t quay.io/codedependant/my-image --build-arg GITHUB_TOKEN --build-arg SOME_VALUE=6eada70 -f Dockerfile .\n$ docker tag <SHA1> latest\n$ docker tag <SHA1> 1.2.0\n$ docker tag <SHA1> 1.2\n$ docker tag <SHA1> 1-latest\n$ docker push quay.io/codedependant/my-image\n```\n\n**minimum configuration**:\n\n```json\n{\n  \"release\": {\n    \"plugins\": [\n      \"@codedependant/semantic-release-docker\"\n    ]\n  }\n}\n```\n\n* A package name `@codedependant/test-project` results in docker project name`codedependant` and image name `test-project`\n* A package name `test-project` results in a docker image name `test-project`\n\nthe default docker image tags for the 1.0.0 release would be `1.0.0`, `1-latest`, `latest`\n\n**example prerelease configuration**:\n\n```json\n{\n  \"release\": {\n    \"dockerTags\": [\n      \"{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}\",\n      \"{{major}}-{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}\",\n      \"{{major}}.{{minor}}-{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}\",\n      \"{{version}}\"\n    ]\n  }\n}\n```\n\nthe docker tags for version `1.2.3` will be `1.2.3`, `1.2-latest`, `1-latest` and `latest`\nthe docker tags for version `2.3.4-beta.6` will be `2.3.4-beta.6`, `2.3-beta`, `2-beta` and `beta`\n\n## Development\n\n### Docker Registry\n\nTo be able to push to the local registry with auth credentials, ssl certificates are required.\nThis project uses self signed certs. To regenerate the certs run the following:\n\n```bash\n$ openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt\n```\n\n**NOTE**: When prompted for an FQDN it must be `registry:5000`\n**NOTE**: The credentials for the local registry are **user:** `iamweasel`, **pass:** `secretsquirrel`\n\n[handlebars]: https://handlebarsjs.com\n[Boolean]: https://mdn.io/boolean\n[String]: https://mdn.io/string\n[Array]: https://mdn.io/array\n[Object]: https://mdn.io/object\n[Number]: https://mdn.io/number\n","readmeFilename":"README.md"}