Giter VIP home page Giter VIP logo

semantic-release-docker-builder's Introduction

semantic-release-docker

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

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

{
  "release": {
    "publish": {
      "path": "x64vs32x-semantic-release-docker-builder",
      "name": "username/imagename"
    }
  }
}

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.

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", {
      "name": "username/imagename"
    }]
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.