{"id":15065982,"url":"https://github.com/crazyfactory/docker-project-cli","last_synced_at":"2025-04-10T13:40:19.588Z","repository":{"id":44848960,"uuid":"94194984","full_name":"crazyfactory/docker-project-cli","owner":"crazyfactory","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-25T10:05:34.000Z","size":2775,"stargazers_count":4,"open_issues_count":24,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-24T12:21:26.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crazyfactory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-13T09:24:31.000Z","updated_at":"2024-11-25T10:05:38.000Z","dependencies_parsed_at":"2023-02-09T10:46:08.073Z","dependency_job_id":null,"html_url":"https://github.com/crazyfactory/docker-project-cli","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazyfactory%2Fdocker-project-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazyfactory%2Fdocker-project-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazyfactory%2Fdocker-project-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazyfactory%2Fdocker-project-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crazyfactory","download_url":"https://codeload.github.com/crazyfactory/docker-project-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225905,"owners_count":21068082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T00:58:59.086Z","updated_at":"2025-04-10T13:40:19.570Z","avatar_url":"https://github.com/crazyfactory.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-project-cli\n\n[![npm](https://img.shields.io/npm/v/@crazyfactory/docker-project-cli.svg)](http://www.npmjs.com/package/@crazyfactory/docker-project-cli)\n[![Build Status](https://travis-ci.org/crazyfactory/docker-project-cli.svg?branch=master)](https://travis-ci.org/crazyfactory/docker-project-cli)\n[![dependencies Status](https://david-dm.org/crazyfactory/docker-project-cli/status.svg)](https://david-dm.org/crazyfactory/docker-project-cli)\n[![devDependencies Status](https://david-dm.org/crazyfactory/docker-project-cli/dev-status.svg)](https://david-dm.org/crazyfactory/docker-project-cli?type=dev)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Greenkeeper badge](https://badges.greenkeeper.io/crazyfactory/docker-project-cli.svg)](https://greenkeeper.io/)\n\nA simple CLI tool simplify docker based project administration. Not meant to replace anything, just reducing your CLI overhead.\n\n## Installation\n\nInstall it globally for quick access\n\n    $ npm i -g @crazyfactory/docker-project-cli\n\nOptionally install it locally, to pin down versions if required.\n\n    $ npm i --save @crazyfactory/docker-project-cli\n\n\n## Configuration\n\nConfiguration of DOPR can be done either via `package.json` under the `dopr` key or with a provided file defaulting to `docker-project.json`.\n\n**Default configuration:**\n```json\n{\n  \"file\": [\"./docker/docker-compose.yml\"],\n  \"service\": null,\n  \"exec\": true,\n  \"actions\": {\n    \"down\": {\n      \"comment\": \"Stop and destroy the docker containers\",\n      \"command\": [\"%action% %args%\"],\n      \"exec\": false\n    },\n    \"up\": {\n      \"comment\": \"Bring the docker containers up and live\",\n      \"command\": [\"%action% %args%\"],\n      \"exec\": false\n    },\n    \"pull\": {\n      \"comment\": \"Pull the latest versions of docker containers\",\n      \"command\": [\"%action% %args%\"],\n      \"exec\": false\n    },\n    \"start\": {\n      \"comment\": \"Start the docker containers\",\n      \"command\": [\"%action% %args%\"],\n      \"exec\": false\n    },\n    \"stop\": {\n      \"comment\": \"Stop the docker containers\",\n      \"command\": [\"%action% %args%\"],\n      \"exec\": false\n    },\n    \"ip\": {\n      \"comment\": \"Print container IP address\",\n      \"service\": \"@host\",\n      \"command\": [\"docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %args%\"]\n    },\n    \"bash\": {\n      \"comment\": \"Open the interactive terminal from default service container\",\n      \"command\": [\"%action% %args%\"]\n    },\n    \"composer\": {\n      \"comment\": \"Run the composer command in default service container\",\n      \"command\": [\"%action% %args%\"]\n    },\n    \"node\": {\n      \"comment\": \"Run the node command in default service container\",\n      \"command\": [\"%action% %args%\"],\n      \"user\": \"node\"\n    },\n    \"npm\": {\n      \"comment\": \"Run the npm command in default service container\",\n      \"command\": [\"%action% %args%\"],\n      \"user\": \"node\"\n    },\n    \"git\": {\n      \"comment\": \"Run the git command in default service container\",\n      \"command\": [\"%action% %args%\"]\n    },\n    \"yarn\": {\n      \"comment\": \"Run the yarn command in default service container\",\n      \"command\": [\"%action% %args%\"]\n    },\n    \"php\": {\n      \"comment\": \"Run the php command in default service container\",\n      \"command\": [\"%action% %args%\"]\n    }\n  }\n}\n```\n\n*Notes:*\n- This will relay `up`, `down`, `start` and `stop` to `docker compose -f \u003cfile\u003e $params$`\n- This will add custom commands like `dopr bash ...`, `dopr composer ...` and `dopr optimize`\n- The `node` will be launched with the user `node` by default.\n- This will use a different config if NODE_ENV is set to *production* or if dopr is with `--env production`.\n- The `\"file\"` value can be array or string.\n- Use `dopr ip \u003ccontainer-name\u003e` to print the IP address of container.\n- To change service container for above default actions simply extend the node with override `\"service\"` only.\n\n**Sample configuration with all usecases:**\n\n```json\n{\n  \"actions\": {\n    \"multiple-cmd\": {\n      \"command\": [\"echo multiple command as array\", \"@nested-cmd arg1 arg2\"]\n    },\n    \"nested-cmd\": {\n      \"command\": [\"echo nested command %args%\", \"@deepnested-cmd --opt1 val1 --opt2 val2\"]\n    },\n    \"deepnested-cmd\": {\n      \"command\": [\"echo deep nested command %args%\"]\n    },\n    \"host-cmd\": {\n      \"service\": \"@host\",\n      \"command\": \"docker compose version\"\n    },\n    \"composer\": {\n      \"args\": \"install --prefer-dist --no-scripts\",\n      \"command\": \"%action% %args%\"\n    }\n  }\n}\n```\n\n*Notes:*\n- The `\"actions\".[$key].\"command\"` can be either array or string.\n- The command can be reused or recalled by prefixing it with `@` (see sample above).\n- The command that should run in host context will need `\"service\"` value of `\"@host\"` (see sample above).\n- The action can optionally provide default arguments in `\"args\"` used to interpolate `%args%` when no other argument is provided (see `\"composer\".\"args\"` above).\n\n## Usage\n\n### docker-compose shortcuts\n`dopr` will choose the correct docker-compose file for you and relay some of the most basic commands directly to docker compose.\n\nTo start you project in deamon mode run\n\n    $ dopr up -d\n\nYou can similarly use `down` and `stop`, just like you would with `docker compose` directly.\n\n### custom commands\n\nYou can add simple custom commands, but we add some by default. They are passed through to the service specified in your dopr configuration.\n\nFor instance to open a bash session just run\n\n    $ dopr bash\n\nYou can similarly access `node`, `npm`, `git` and `composer` like so\n\n    $ dopr npm run my-script\n\nor so\n\n    $ dopr composer dump-autoload -o\n\nUsing the configuration you can add your own commands. If you want to use `yarn` for instance, simply add it\n```json\n{\n  \"action\": [\n    \"yarn\"\n  ]\n}\n```\n\nYou can also specify a different service if required. So you can add shortcuts for other docker instances like mysql as well.\n```json\n{\n  \"action\": [\n    {\n      \"key\": \"mysql\",\n      \"service\": \"mysql-service\"\n    }\n  ]\n}\n```\n\n## License\n\nCopyright (c) 2017 Crazy Factory Trading Co. Ltd.\n\nLicensed under the MIT license.\n\nSee LICENSE for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazyfactory%2Fdocker-project-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrazyfactory%2Fdocker-project-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazyfactory%2Fdocker-project-cli/lists"}