Giter Club home page Giter Club logo

decomposerize's Introduction

decomposerize

Netlify Status npm ShareVB on GitHub

http://decomposerize.com - Turns docker-compose file into docker run commands!

Looking for the reverse : http://composerize.com / Composerize

Want to convert from Docker compose file formats : http://composeverter.com / Composeverter

CLI

decomposerize can be run in the cli.

npm install decomposerize -g to install, and run as such:

$ decomposerize << docker-compose.yml

API

convertToDockerRunCommands(dockerComposeContent, configuration={})

  • dockerComposeContent: A string representing the Docker Compose file input.
  • configuration: optional configuration options in form of an object
    • command: A string that defines the Docker command to generate (e.g., 'docker run', 'docker create', 'docker container run'). It has a default value of 'docker run'.
    • rm: A boolean that, when true, adds the '--rm' option to the command line arguments. The default value is false.
    • detach: A boolean that, when true, adds the '-d' option to the command line arguments. The default value is false.
    • multiline: A boolean that, when true, emits the command in multiline shell command format. The default value is false.
    • 'long-args': A boolean that, when true, emits long command line arguments (e.g., '--tty' instead of '-t'). The default value is false.
    • 'arg-value-separator': A string representing the separator used between command arguments and their values. It can be either ' ' (space) or '='. The default value is ' ' (space).

returns

It returns the Docker run command(s) generated based on the input Docker Compose file and the provided configuration

How to use with node.js

Make sure to install the composerize package in your project by running:

npm install decomposerize

With the following code, you can easily integrate Decomposerize into your Node.js project and generate Docker run command(s) from Docker Compose configurations.

const convertToDockerRunCommands = require('decomposerize');

const dockerComposeInput = `
version: '3'
services:
  myapp:
    image: myapp-image
`;

const configuration = {
  command: 'docker run',
  rm: true,
  detach: false,
  multiline: true,
  'long-args': false,
  'arg-value-separator': ' ',
};

const dockerRunCommands = convertToDockerRunCommands(dockerComposeInput, configuration);

console.log('Generated Docker Run Commands:');
console.log(dockerRunCommands);

Contributing

  • Clone a fork of the repo and install the project dependencies by running yarn
  • Make your changes, and build the project by running make build
  • Test your changes with make test

yarn version

Needs [email protected]. See yarnpkg/yarn#7734.

Maintainers

decomposerize's People

Contributors

sharevb avatar

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.