npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-ship-cli

v1.0.4

Published

Build, tag and push docker images in one command.

Downloads

4

Readme

docker-ship

Build, tag and push docker images in one command.

The example above is equal to running the following docker-commands:

$ docker build -t jmyrland/test .
$ docker tag 9392f4f2e09c jmyrland/test:1.0.0
$ docker push jmyrland/test:1.0.0
$ docker push jmyrland/test:latest

Installation:

npm i -g docker-ship-cli

Usage:

docker-ship [imageName] [nextVersion]

Positionals:
  nextVersion  version to deploy (prompted if missing)                  [string]
  imageName    docker image name (prompted if missing)                  [string]

Options:
  --update-pkg, -u  Update the version in package.json                 [boolean]
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]

Executing docker-ship with the same parameters, with only the nextVersion changing can be tedious. You can add default values to a package.json file to avoid this.

When executing docker-ship in a folder with the following package.json file, both version and dockerRepository will be read as parameters.

{
  "version": "1.0.0",
  "dockerRepository": "jmyrland/test"
}
  • version is treated as the current version of the docker image, and will be used to ensure that the next version is newer. It will also be used to suggest a new version (when prompted).
  • dockerRepository is treated as the imageName.

Custom pre build and post push actions

You can add custom tailored pre-build and post-push actions by adding a docker-ship-module to your project.

The docker-ship-module is just a simple nodejs module, and looks like this in its simplest form:

module.exports = {
  handlePreBuild: async ({ inquirer, spinner }, args) => { },
  handlePostPush: async ({ inquirer, spinner }, args) => { }
}

These handlers are invoked in the docker-ship/deployment lifecycle as advertised. In addition to the args (imageName, nextVersion, etc.), these handlers are also given a reference to inquirer and an ora spinner instance - in case you want to "inquire" input or display a nice spinner if you are doing some heavy lifting.

Take a look at a simple example of a docker-ship-module.

Use cases for these actions:

  • Clean up / build project before building the docker image is built.
  • After push, remote in to a server and pull the latest image (or the specific version)
  • After push, broadcast a notification to your team's chat service

Tested with

  • macOS version 10.13.4
  • Node version 8+
  • Docker version 18.04.0-ce-rc2, build f4926a2