Socket
Socket
Sign inDemoInstall

@dqunbp/semantic-release-docker

Package Overview
Dependencies
456
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dqunbp/semantic-release-docker

Set of semantic-release plugins to publish to docker hub


Version published
Maintainers
1
Install size
256 kB
Created

Readme

Source

@dqunbp/semantic-release-docker

Upgraded fork of semantic-release-docker

npm build downloads dependencies peerDependencies code style: prettier semantic-release license

Set of semantic-release plugins for publishing a docker image to Docker Hub.

{
  "release": {
    "verifyConditions": {
      "path": "@dqunbp/semantic-release-docker",
      "registryUrl": "docker.io"
      // You can also pass name of corresponding env variable
      // "registryUrl": "$DOCKER_REGISTRY_URL"
    },
    "publish": {
      "path": "@dqunbp/semantic-release-docker",
      "imageName": "username/imagename"
      // You can also pass name of corresponding env variable
      // "imageName": "$DOCKER_IMAGE_NAME"
    }
  }
}

You can also pass registryUrl and image name as env variables

Configuration

Your credentials have to be configured with the environment variables DOCKER_USERNAME and DOCKER_PASSWORD.

In addition, you need to specify the name of the image as the name setting in the publish step. If you need to specify a custom docker registry URL, add it as the registryUrl setting in the verifyConditions step.

You can also specify registryUrl and imageName as env variables, their names must starts with $.

Plugins

verifyConditions

Verify that all needed configuration is present and login to the Docker registry.

publish

Tag the image specified by name with the new version, push it to Docker Hub and update the latest tag.

Example .travis.yml

jobs:
  include:
    - stage: release
      language: node_js
      node_js: "8"
      services:
        - docker
      script:
        - docker build -t username/imagename .
        - npm run semantic-release

stages:
  - test
  - name: release
    if: branch = master AND type = push AND fork = false

branches:
  except:
    - /^v\d+\.\d+\.\d+$/

Circle CI Example .config.yml

version: 2
jobs:
  release:
    docker:
      - image: circleci/node:8
    steps:
      - setup_remote_docker:
          docker_layer_caching: true
      - run:
          name: release
          command: |
            docker build -t username/imagename .
            npm run semantic-release

workflows:
  version: 2
  pipeline:
    jobs:
      - test
      - release:
          requires:
            - test
          filters:
            branches:
              only: master

Note that setup_remote_docker step is required for this plugin to work in Circle CI environment

How to keep new version in package.json inside docker image?

In order to do that you need to run docker build command during semantic-release prepareCmd event.

It can be done with help of @semantic-release/exec for example.

{
  "plugins": [
    ...[
      "@semantic-release/exec",
      {
        "prepareCmd": "docker build -t username/imagename ."
      }
    ],
    "semantic-release-docker"
  ]
}

Keywords

FAQs

Last updated on 14 May 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