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

dockerforged

v1.0.1

Published

CLI tool to generate dockerfile definitions and scaffold project templates

Downloads

1

Readme

Command line tool to generate dockerfile definitions and scaffold project templates for CI/CD operations.

Motivation 🔥

Upon creating Docker projects and modules, I observed a recurring pattern in the necessary files and considered streamlining it with a cli tool. Typically, to dockerize a project the directory must contain the following:

  • The src folder containing the code.
  • The Dockefile for building the docker image.
  • (Optionally) The config file for runtime configuration.
  • (Optionally) The .env file for setting environmental variables.
  • (Optionally) The docker-compose.yaml for creating a Docker service stack.

Dockerforge intends to automate the creation of these files while also providing scaffolded templates for the various programming languages. This can help you shorten the time it takes to go from idea to development to production and reduce the time required to dockerize your application.

Installation

Using

To install tool, execute the following command:

npm install -g dockerforged

Using bun

To install tool, execute the following command:

bun install -g dockerforged

Usage 🚀

The tool generates docker definitions ( Dockerfile, docker-compose.yaml, docker-compose.production.yaml ) for the selected programming language in the current directory. This definitions include a structure for building the docker image of your application using two phases, development and production. When the docker-compose.yaml file is used to create a docker service then the development phase of the docker image is utilized allowing for hot-reload of your code inside the container. When the docker-compose.production.yaml file is invoked, then the corresponding production phase of the docker image is used. Once installed, you can use the tool interactively or with cli options by executing the dockeforge command:

The tool can also scaffold a template project, creating an src directory for your project and the accompanying package manager for the selected language. After running the command shown above the project directory has the following structure:

Programming Languages 📚

The tool supports docker definitions and scaffolded templates ( src, language package managers ) for the following programming languages:

  • NodeJS with package.json
  • Typescript with package.json and tsconfig.json
  • Python with requirements.txt
  • Golang with go.mod
  • Rust with Cargo.toml

CLI Options ⚙️

The tool is interactive, but it can also be used with cli options, which are the following:

$ dockerforge -h

Usage: dockerforge [options]

🐳 Dockerfile generator cli tool for CD/CI operations.

Options:
  -n,--name <string>      Target project name
  -e,--env                Create project .env file
  -m,--makefile           Create project Makefile
  -s,--scaffold           Scaffold template project with 'src' structure
  -c,--config <string>    Create project config file (choices: "json", "toml", "yaml", "ini", "none")
  -l,--language <string>  Target project language (choices: "typescript", "javascript", "python", "golang", "rust")
  -v, --version           Output the current version
  -h,--help               Display this help message

-n, --name <string>

  • This option sets the name of the target project, this will be used in the generated dockerfile definitions. By default it set to the current working directory.

-e, --env

  • This option creates an empty .env inside the current working directory.

-m, --makefile

  • This option creates a Makefile with docker command shortcuts for development & building inside the current working directory. These command shortcuts are listed below.
  • Makefile: Use make <command> to run this shortcuts in the cli:
    • start: Command shortcut for docker-compose up -d
    • stop: Command shortcut for docker-compose down -v
    • build: Command shortcut for docker build -t project-app .
    • remove: Command shortcut for docker image rm project-app
    • update: Command shortcut for running the stop, remove and start shortcuts sequentially.
    • production: Command shortcut for docker-compose -f docker-compose.yaml -f docker-compose.production.yaml up -d. Basicaly uses compose file along with the production compose file.
    • run: Command shortcut for running the code in the src folder.

-s, --scaffold

  • This option scaffold a project template for the selected programming language. If an src file already exists in the current working directory, this option will have no effect.

-c, --config <string>

  • This option creates a configuration file of the chosen extension inside the current working directory. If a config file with the same file extention exists in the current working directory, this option will have no effect.

-l, --language <string>

  • This option sets the target programming language of the project.

-v, --version

  • This option outputs the currect version of the tool.

-h, --help

  • This option outputs the help message shown in the previous section.