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

wf-docker

v1.0.3

Published

CLI tool for generating docker files from a template, building images from it, publishing them and optionally generating a readme file.

Downloads

10

Readme

Workflow - Docker

CLI tool for generating docker files from a template, building images from it, publishing them and optionally generating a readme file.

success.png

Install

Locally for the project (package.json is required)

npm install wf-docker

Globally

npm install -g wf-docker

Usage

Use this repository also as an example how to build docker images - this is build with current node versions.

Create Dockerfile.template in your directory.

  • This is a base docker file that will be created. Build context is in your root folder.
  • Directory will be created with tag name (if missing) and Dockerfile will be created from the template inside the directory.
  • There are several tags that can be used in the template. More in tags.md.

(optional) Create readme.template.md in your root directory.

  • If file is present, it will generate readme from the template.
  • There are several tags that can be used in the template. More in tags.md.
  • Example in readme.template.md

Configuration

Configuration is defined in json structure to allow cli usage without required arguments to be passed (as image name / tags)

You can use two ways:

  1. Updating your package.json with wf-docker object in root of your package.json. For example check our package.json.
  2. Create .wf-docker.json with same structure.

Config

  • name: Defines the image name
  • description: Your description. Used for generating readme. If package.json is used as config and description is not set, then root description is used.
  • tags: Provide a list of docker images
  • run: After building image run given commands on the built image
{
  "name": "package/your-package",
  "wf-docker": {
    "image": "@namespace/@yourpackage",
    "tags": [
      "12",
      "14",
      "16",
      "17"
    ],
    "run": [
      "node --version",
      "npm --version"
    ]
  }
}
Tags with custom replacement

This feature enables replacing custom variables for each tag version. Instead of string for tag use an object.

{
  "tags": [
    "12",
    {
      "tag": "7.4-node-14",
      "docker": {
        "php": "7.4",
        "node": "14",
        "composer": "v2.1.14"
      }
    },
    {
      "tag": "7.4-node-10",
      "docker": {
        "php": "7.4",
        "node": "10",
        "composer": "v2.1.14"
      }
    }
  ]
}

The install will be translated to --install-- key that will be replaced in your docker template

Commands

Image name and a list of tags are required if package.json does not exists in your directory.

Usage: 
    wf-docker build imageName tag1 tag2 ...
    wf-docker push imageName tag1 tag2 ...
    wf-docker build-push imageName tag1 tag2 ...
    wf-docker generate-readme imageName tag1 tag2
    
Options:
    --no-cache Do not use cache when building
    --help Print this help message
    --verbose, -v Prints docker build output

Docker

You can use already built docker image.

docker run work-flow/wf-docker:12 wf-docker --version

You probably need to volume map to /app folder. For CI usage should be fine (not tested at this moment).

Docker images with different node versions (wrkflow/wf-docker)

Image | Badges --- | --- wrkflow/wf-docker:12 | wrkflow/wf-docker:14 | wrkflow/wf-docker:16 | wrkflow/wf-docker:17 | wrkflow/wf-docker:12-alpine | wrkflow/wf-docker:14-alpine | wrkflow/wf-docker:16-alpine | wrkflow/wf-docker:17-alpine |

TODO

  • [ ] Improve docs feedback wanted
  • [ ] Parallel building
  • [x] Ability to build only readme (partialy done)
  • [x] Custom config file (to not force package.json)
  • [ ] Customize file names / directory for templates.
  • [ ] Base template
  • [ ] Init command?
  • [ ] Github badges if set?
  • [ ] Github actions atuomation for minor version update?
  • [ ] Unit tests
  • [ ] Auto-test build
  • [ ] Append run response to readme