{"id":13536949,"url":"https://github.com/rosineygp/mkdkr","last_synced_at":"2025-04-07T05:14:09.251Z","repository":{"id":50949822,"uuid":"227120483","full_name":"rosineygp/mkdkr","owner":"rosineygp","description":"mkdkr = Makefile + Docker","archived":false,"fork":false,"pushed_at":"2021-05-27T00:40:23.000Z","size":7176,"stargazers_count":372,"open_issues_count":0,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T04:05:55.336Z","etag":null,"topics":["bash","cirleci","docker","github-actions","gitlab-ci","jenkins","makefile","pipelines","travis-ci"],"latest_commit_sha":null,"homepage":"https://rosineygp.github.io/mkdkr/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosineygp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-10T12:53:23.000Z","updated_at":"2025-03-22T20:32:53.000Z","dependencies_parsed_at":"2022-09-03T05:01:54.513Z","dependency_job_id":null,"html_url":"https://github.com/rosineygp/mkdkr","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosineygp%2Fmkdkr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosineygp%2Fmkdkr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosineygp%2Fmkdkr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosineygp%2Fmkdkr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosineygp","download_url":"https://codeload.github.com/rosineygp/mkdkr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"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":["bash","cirleci","docker","github-actions","gitlab-ci","jenkins","makefile","pipelines","travis-ci"],"created_at":"2024-08-01T09:00:52.401Z","updated_at":"2025-04-07T05:14:09.212Z","avatar_url":"https://github.com/rosineygp.png","language":"Shell","funding_links":[],"categories":["Shell","bash","For Developers","Applications","\u003ca name=\"devops\"\u003e\u003c/a\u003eDevOps"],"sub_categories":["Tools","Directory Navigation"],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca alt=\"mkdkr\" href=\"https://rosineygp.github.io/mkdkr\"\u003e\n    \u003cimg src=\"https://github.com/rosineygp/mkdkr/raw/master/media/logo.png?raw=true\" width=\"128\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# mkdkr \u003c!-- omit in toc --\u003e\n\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Frosineygp%2Fmkdkr%2Fbadge%3Fref%3Dmaster\u0026style=flat)](https://actions-badge.atrox.dev/rosineygp/mkdkr/goto?ref=master)\n[![Build Status](https://travis-ci.org/rosineygp/mkdkr.svg?branch=master)](https://travis-ci.org/rosineygp/mkdkr)\n[![pipeline status](https://gitlab.com/rosiney.gp/mkdkr/badges/master/pipeline.svg)](https://gitlab.com/rosiney.gp/mkdkr/commits/master)\n[![CircleCI](https://circleci.com/gh/rosineygp/mkdkr/tree/master.svg?style=svg)](https://circleci.com/gh/rosineygp/mkdkr/tree/master)\n[![GitHub license](https://img.shields.io/github/license/rosineygp/mkdkr.svg)](https://github.com/rosineygp/mkdkr/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/rosineygp/mkdkr.svg)](https://GitHub.com/rosineygp/mkdkr/releases/)\n[![kcov](https://img.shields.io/endpoint?url=https%3A%2F%2Fmkdkr.surge.sh%2Fcoverage.json)](https://mkdkr.surge.sh/)\n[![CodeFactor](https://www.codefactor.io/repository/github/rosineygp/mkdkr/badge)](https://www.codefactor.io/repository/github/rosineygp/mkdkr)\n![Docker Pulls](https://img.shields.io/docker/pulls/rosiney/mkdkr)\n![GitHub all releases](https://img.shields.io/github/downloads/rosineygp/mkdkr/total)\n\n\u003e mkdkr = Makefile + Docker\n\nSuper small and powerful framework for build CI pipeline, scripted with Makefile and isolated with docker.\n\n- Dependencies: [ [make](https://www.gnu.org/software/make/manual/make.html), [docker](https://www.docker.com/), [bash](https://www.gnu.org/software/bash/), [git](https://git-scm.com/) ]\n- Two files only (Makefile and .mkdkr), less garbage on your repo\n- All power of make, docker and bash\n- Shipping and switch among CI engines like\n[Circle CI](https://circleci.com/gh/rosineygp/mkdkr),\n[GitHub Actions](https://actions-badge.atrox.dev/rosineygp/mkdkr/goto?ref=master),\n[Gitlab-ci](https://gitlab.com/rosiney.gp/mkdkr/pipelines), Jenkins, [Travis](https://travis-ci.org/rosineygp/mkdkr/builds).. and more [using exporter](#export)\n- Clean and elegant code syntax\n\n\u003cp align=\"center\"\u003e\n\t\u003ca alt=\"terminalizer\" href=\"https://terminalizer.com/view/a07de9182694\"\u003e\n    \t\u003cimg src=\"https://github.com/rosineygp/mkdkr/raw/master/media/presentation.gif?raw=true\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\nTable of contents\n-----------------\n\n- [Usage](#usage)\n\t- [Makefile](#makefile)\n\t- [Execute](#execute)\n\t- [Result](#result)\n\t- [Export](#export)\n\t- [Demonstration](#demonstration)\n\t\t- [My Workflow - Configuración automática de CI/CD](#my-workflow---configuración-automática-de-cicd)\n- [Reason](#reason)\n- [Functions](#functions)\n\t- [@$(dkr)](#dkr)\n\t- [instance:](#instance)\n\t- [service:](#service)\n\t- [dind:](#dind)\n\t- [run:](#run)\n\t- [var-run:](#var-run)\n\t- [login:](#login)\n\t- [retry:](#retry)\n\t- [log:](#log)\n\t- [push:](#push)\n\t- [pull:](#pull)\n\t- [cd:](#cd)\n- [Includes](#includes)\n\t- [Explicit](#explicit)\n\t- [Implicit](#implicit)\n\t- [mkdkr.csv](#mkdkrcsv)\n\t- [Collection](#collection)\n- [Builtin Targets](#builtin-targets)\n\t- [_list](#_list)\n- [Helpers](#helpers)\n- [Examples](#examples)\n\t- [Simple](#simple)\n\t- [Service](#service-1)\n\t- [DIND](#dind-1)\n\t- [Escapes](#escapes)\n\t- [Shell](#shell)\n\t- [Stdout](#stdout)\n\t- [Pipelines](#pipelines)\n- [Environment Variables](#environment-variables)\n- [Migration](#migration)\n\n# Usage\n\n## Makefile\n\nCreate a file with name Makefile and paste the following content.\n\nDownload `.mkdkr` **dynamically**.\n\n```Makefile\n# Required header\ninclude $(shell [ ! -f .mkdkr ] \u0026\u0026 curl -fsSL https://git.io/JOBYz \u003e .mkdkr; bash .mkdkr init)\n\n# without shorten url\n# include $(shell [ ! -f .mkdkr ] \u0026\u0026 curl -fsSL https://github.com/rosineygp/mkdkr/releases/latest/download/mkdkr \u003e .mkdkr; bash .mkdkr init)\n\njob:\n\t@$(dkr)\n\tinstance: alpine\n\trun: echo \"hello mkdkr dynamic!\"\n```\n\n**OR** keep `.mkdkr` **locally**.\n\n```bash\n# Download .mkdkr\ncurl -fsSL https://github.com/rosineygp/mkdkr/releases/latest/download/mkdkr \u003e .mkdkr\n```\n\n```Makefile\n# Required header\ninclude $(shell bash .mkdkr init)\n\njob:\n\t@$(dkr)\n\tinstance: alpine\n\trun: echo \"hello mkdkr local!\"\n```\n\n**.gitignore (optional)**\n\n```.gitignore\n.tmp\n.mkdkr # only in dynamic config\n```\n\n## Execute\n\n```bash\n# execute\nmake job\n```\n\n## Result\n\n```bash\nstart: job\n\n\ninstance: alpine\n20498831fe05f5d33852313a55be42efd88b1fb38b463c686dbb0f2a735df45c\n\nrun: echo hello mkdkr!\nhello mkdkr!\n\ncleanup:\n20498831fe05\n\ncompleted:\n0m0.007s 0m0.000s\n0m0.228s 0m0.179s\n```\n\n## Export\n\nRun your current Makefile in another engine, like **travis** or **github actions**, use the dynamic include [exporter](https://github.com/rosineygp/mkdkr_exporter).\n\n## Demonstration\n\n### My Workflow - Configuración automática de CI/CD\n\n[![My Workflow - Configuración automática de CI/CD](https://img.youtube.com/vi/DwDNqefP0v0/0.jpg)](https://www.youtube.com/watch?v=DwDNqefP0v0)\n\nAuthor: Martin Algañaraz\n\n# Reason\n\nBuild pipeline for a dedicated platform can take a lot of time to learn and test, with **mkdkr** you can test all things locally and run it in any pipeline engine like Jenkins, Actions, Gitlab-ci and others.\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"ttps://imgs.xkcd.com/comics/standards.png\"\u003e\n    \u003cimg alt=\"standards\" src=\"https://imgs.xkcd.com/comics/standards.png\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Functions\n\n## @$(dkr)\n\nLoad docker layer for mkdkr, use inside a target of Makefile.\n\n```Makefile\n\nshell-only:\n\techo \"my local shell job\"\n\nmkdkr-job:\n\t@$(dkr)            # load all deps of mkdkr\n\tintance: alpine\n\trun: echo \"my mkdkr job\"\n```\n\n## instance:\n\nCreate docker containers, without special privileges.\n\n```Makefile\nmy-instance:\n\t@$(dkr)\n\tinstance: ubuntu:20.04     # create a instance\n```\n\n**Parameters:**\n\n- String, DOCKER_IMAGE *: any docker image name\n- String|Array, ARGS: additional docker init args like (--cpus 1 --memory 64MB)\n\n**Return:**\n- String, Container Id\n\n\u003e Calling **instance:** twice, it will replace the last container.\n\n## service:\n\nCreate a docker container in detached mode. Useful to bring up a required service for a job, like a webserver or database.\n\n```Makefile\nmy-service:\n\t@$(dkr)\n\tservice: nginx    # up a nginx\n\tinstance: alpine\n```\nIs possible start more than one service.\n\n```Makefile\nmulti-service:\n\t@$(dkr)\n\tservice: mysql\n\tservice: redis\n\tinstance: node:12\n\trun: npm install\n\trun: npm test\n```\n\n\u003e \\* Instance and services are connected in same network\u003cbr\u003e\n\u003e \\*\\* The name of service is the same of image name with safe values\n\n| Image Name                 | Network Name               |\n|----------------------------|----------------------------|\n| nginx                      | nginx                      |\n| nginx:1.2                  | nginx_1_2                  |\n| redis:3                    | redis_3                    |\n| project/apache_1.2         | project_apache_1_2         |\n| registry/my/service:latest | registry_my_service_latest |\n\n\u003e replace role `'s/:|\\.|\\/|-/_/g'`\n\n**Parameters:**\n\n- String, DOCKER_IMAGE *: any docker image name\n- String|Array, ARGS: additional docker init args like (--cpus 1 --memory 64MB)\n\n**Return:**\n- String, Container Id\n\n\u003e instance or dind created after a service, will be automatically linked.\n\n## dind:\n\nCreate a docker instance with daemon access. Useful to build docker images.\n\n```Makefile\nmy-dind:\n\t@$(dkr)\n\tdind: docker:19\n\trun: docker build -t my/dind .\n```\n**Parameters:**\n\n- String, DOCKER_IMAGE *: any docker image name\n- String|Array, ARGS: additional docker init args like (--cpus 1 --memory 64MB)\n\n**Return:**\n- String, Container Id\n\n## run:\n\nExecute a command inside docker container [**instance:** or **dind:**] (the last one).\n\n\u003e Is not possible to execute commands in a **service**.\n\n**Parameters:**\n- String|Array, command: any sh command eg. 'apk add nodejs'\n\n**Return:**\n- String, Command(s) output\n\n**Usage**\n\n```Makefile\nmy-run:\n\t@$(dkr)\n\tinstance: alpine\n\t# run a command inside container\n\trun: apk add curl\n\n\tinstance: debian\n\t# avoid escape to host bash, escapes also can be used (eg. \\\u0026\\\u0026)\n\trun: 'apt-get update \u0026\u0026 \\\n\t\t\tapt-get install -y curl'\n\n\t# run a command inside container and redirect output to host\n\trun: ls -la \u003e myfile\n\n\t# run a command inside container and redirect output to container\n\trun: 'ls -la \u003e myfile'\n```\n\n## var-run:\n\nExecute a command inside docker container [**instance:** or **dind:**] and return stdout at named var.\n\n\u003e After created var it is passed to next `run:` or `var-run:` execution.\n\n**Parameters:**\n- String, var: any bash valid variable name\n- String|Array, command: any sh command eg. 'apk add nodejs'\n\n**Return:**\n- String, Command(s) output\n\n**Usage**\n\n```Makefile\nmy-var-run:\n\t@$(dkr)\n\tinstance: alpine\n\t# run a command inside container\n\tvar-run: myvar hostname\n\trun: echo '$$myvar'\n\tvar-run: mynewvar echo '$$myvar'\n\trun: echo \"$$myvar $$mynewvar\"\n```\n\n## login:\n\nExecute docker login in a private registry.\nIf docker instance exist, execute login inside container otherwise at host.\n\n**Parameters:**\n- String, domain: private registry domain.\n- String| user: registry username.\n- String| password: registry password.\n\n**Return:**\n- None.\n\n**Usage**\n\n```Makefile\nprivate-registry:\n\t@$(dkr)\n\tlogin: my.private.registry foo $(MKDKR_PASSWORD)\n\tinstance: my.private.registry/alpine\n```\n\n\u003e Execute login at host and download image from private registry (login before instance creation)\n\n```Makefile\nprivate-registry:\n\t@$(dkr)\n\tdind: docker:19\n\tlogin: my.private.registry foo $(MKDKR_PASSWORD)\n\tinstance:  my.private.registry/alpine\n```\n\n\u003e Execute login inside instance and download image from private registry (login after instance creation)\n\n## retry:\n\nExecute a command inside docker container [**instance:** or **dind:**] (the last one), with retry options.\n\n\u003e Is not possible to execute commands in a **service**.\n\n**Parameters:**\n- Number|Int, attempts: number of attempts before crash.\n- Number|Int, sleep: time sleeping before retry.\n- String|Array, command: any sh command eg. 'curl https://tomcat:8080'\n\n**Return:**\n- String, Command(s) output\n\n**Usage**\n\n```Makefile\ndeploy:\n\t@$(dkr)\n\tinstance: oc\n\tretry: 3 10 oc apply -f build.yml\n\t#the job can run 3 times with a delay of ten seconds\n\nnpm:\n\tinstance: alpine\n\trun: apk add curl\n\tservice: my-slow-service\n\tretry: 60 1 curl http://my-slow-service:8080\n```\n\n## log:\n\nAll output steps executed in a job (except log:) is stored and can be reused during future steps.\n\n**Parameters:**\n- Number: The number represent the step in a job and start with 0.\n\n**Return:**\n- Text, Multiline text.\n\n**Usage**\n\n```Makefile\nmy-log:\n\t@$(dkr)\n\tinstance: alpine\n\trun: apk add curl jq\n\trun: curl http://example.com\n\tlog: 1 \\| jq '.'\n```\n\n## push:\n\nPush files/folders to a container job from local filesystem.\n\n**Parameters:**\n- String, from: Target files/folders in local filesystem.\n- String, to: Destiny of files/folders inside container.\n\n**Return**\n- None.\n\n**Usage**\n\n```Makefile\npush:\n\t@$(dkr)\n\tinstance: ansible\n\tpush: /etc/ansible/inventory/hosts.yml\n\trun: ansible-playbook main.yml\n```\n\n[Example](examples/push.mk)\n\n## pull:\n\nPull files/folders from a container job to local filesystem.\n\n**Parameters:**\n- String, from: Target files/folders inside container.\n- String, to: Destiny of files/folders in local filesystem.\n\n**Return**\n- None.\n\n**Usage**\n\n```Makefile\npull:\n\t@$(dkr)\n\tinstance: debian\n\trun: curl https://example.com -o /tmp/out.html\n\tpull: /tmp/out.html .\n```\n\n[Example](examples/pull.mk)\n\n## cd:\n\nMove folder context.\n\n**Parameters:**\n- String, workdir: Set workdir.\n\n**Return**\n- None.\n\n```Makefile\nchange-folder:\n\t@$(dkr)\n\tinstance: debian\n\tcd: /tmp\n\trun: pwd\n\t# /tmp\n```\n\n# Includes\n\nIs possible create jobs or fragments of jobs and reuse it in another projects, like a code package library.\n\nThere are two major behavior of includes:\n\n## Explicit\n\nA fragment of job (eg. `define`) and needs to be called explicitly to work.\n\n```Makefile\nTAG=latest\n\ndefine docker_build =\n\t@$(dkr)\n\tdind: docker:19\n\trun: docker build -t $(REGISTRY)/$(PROJECT)/$(REPOS):$(TAG) .\nendef\n```\nAll definitions will be load at start of makefile, after it is possible to call at your custom job.\n\n```Makefile\nmy-custom-build:\n\t$(docker-build)\n```\n\n## Implicit\n\nJust a full job in another project.\n\n```Makefile\nTAG=latest\n\ndocker_build:\n\t@$(dkr)\n\tdind: docker:19\n\trun: docker build -t $(REGISTRY)/$(PROJECT)/$(REPOS):$(TAG) .\n```\n\nThe jobs will be load at start and can be called directly.\n\n```shell\nmake docker_build\n```\n\n\u003e - No needs to implement the job at main Makefile.\n\u003e - Very useful for similar projects.\n\n## mkdkr.csv\n\nA file with name `mkdkr.csv`, that contains the list of remote includes.\n\nNeeds to be at same place o main Makefile.\n\n```csv\ncommitlint,https://github.com/rosineygp/mkdkr_commitlint.git,master,main.mk\ndocker,https://github.com/rosineygp/mkdkr_docker.git\n```\n\nThe file contains four values per line in following order\n\n| # | Name        | Definition                                                       |\n|---|-------------|------------------------------------------------------------------|\n| 1 | alias *     | unique identifier of include and clone folder destiny            |\n| 2 | reference * | any git clone reference                                          |\n| 3 | checkout    | branch, tag or hash that git can checkout (default master)       |\n| 4 | file        | the fragment of Makefile that will be included (default main.mk) |\n\n\u003e \\* required\n\n## Collection\n\n| Name                                                         | Description                                        |\n|--------------------------------------------------------------|----------------------------------------------------|\n| [docker](https://github.com/rosineygp/mkdkr_docker)          | Build and Push Docker images.                      |\n| [commit lint](https://github.com/rosineygp/mkdkr_commitlint) | Validate commit message with semantic commit.      |\n| [exporter](https://github.com/rosineygp/mkdkr_exporter)      | Generate pipeline definitions files from Makefile. |\n\n\u003e Small collection, use it as example\n\n# Builtin Targets\n\n## _list\n\nList all targets in `Makefile`, include extensions.\n\n```shell\n$ make _list\n\ninclude\n\nalias: exporter, repos: https://github.com/rosineygp/mkdkr_exporter.git, checkout: v1.5.0, file: main.mk\n\nreplace: MKDKR_EXPORTER_TAG=latest to v1.5.0\nbash.v4-0:\nbash.v4-1:\nbash.v4-2:\nbash.v4-3:\nbash.v4-4:\nbash.v5-0:\n_coverage.report:\nexamples.dind:\nexamples.escapes:\nexamples.pipeline:\nexamples.retry:\nexamples.service:\nexamples.shell:\nexamples.simple:\nexamples.stdout:\n_exporter_bitbucket-pipelines:\n_exporter_circle-ci:\n_exporter_github:\n_exporter_gitlab-ci:\n_exporter_jenkins_pipeline:\n_exporter_shell:\n_exporter_travis:\nlint.commit:\nlint.hadolint:\nlint.shellcheck:\ntest.unit:\n```\n\n\u003e The result are sorted by name.\n\u003e \n\u003e First char target name: [a-zA-Z_]\n\n# Helpers\n\nA set of small functions to common pipelines process.\n\n| Name           | Description                                                  | Usage                                        | Output |\n|----------------|--------------------------------------------------------------|----------------------------------------------|--------|\n| slug           | Replace unsafe values from a string                          | `slug \u003cstring\u003e`                              | string |\n| urlencode      | Encode a string to URL format                                | `urlencode \u003cstring\u003e`                         | string |\n| urldecode      | Decode a string from URL format                              | `urldecode \u003cstring\u003e`                         | string |\n| uuid           | Generate UUID                                                | `uuid`                                       | string |\n| ssh-cp-key     | Copy ssh private key for current user                        | `ssh-cp-key \u003ckey-path\u003e`                      | none   |\n| ssh-host-check | Set StrictHostKeyChecking=no                                 | `ssh-host-check \u003chostname:port\u003e`             | none   |\n| git-user       | Configure git.user and git.email                             | `git-user \u003cemail\u003e`                           | none   |\n| git-ssh        | Configure ssh and git [ssh-cp-key, ssh-host-check, git-user] | `git-ssh \u003ckey-path\u003e \u003chostname:port\u003e \u003cemail\u003e` | none   |\n\n```Makefile\nautocommit:\n\t@$(dkr)\n\tinstance: alpine/git\n\tgit-ssh: ~/.ssh/id_rsa github.com auto@mkdkr.com\n\trun: git clone git@github.com:rosineygp/mkdkr.git /auto\n\trun: echo \"my new file\" \\\u003e /auto/my-new-file.txt\n\trun: git -C /auto add my-new-file.txt\n\trun: git -C /auto commit -m \"my automatic change\"\n\trun: git -C /auto push origin master:feat/auto-push\n```\n\n# Examples\n\n## Simple\n\n```Makefile\nsimple:\n\t@$(dkr)\n\tinstance: alpine\n\trun: echo \"hello mkdkr!\"\n```\n\n\u003e Is possible to mix images during job, see in example\n\n[Makefile](examples/simple.mk)\n\n## Service\n\n```Makefile\nservice:\n\t@$(dkr)\n\tservice: nginx\n\tinstance: alpine\n\trun: apk add curl\n\trun: curl -s nginx\n```\n\n[Makefile](examples/service.mk)\n\n## DIND\n\nPrivileged job\n\n```Makefile\ndind:\n\t@$(dkr)\n\tdind: docker:19\n\trun: docker build -t project/repos .\n```\n\n[Makefile](examples/dind.mk)\n\n## Escapes\n\n```Makefile\npipes:\n\t@$(dkr)\n\tinstance: ubuntu:18.04\n\trun: \"find . -iname '*.mk' -type f -exec cat {} \\; | grep -c escapes\"\n```\n\n\u003e More examples at file\n\n[Makefile](examples/escapes.mk)\n\n## Shell\n\nSwitch to another shell\n\n```Makefile\nshell:\n\t@$(dkr)\n\tinstance: ubuntu\n\texport MKDKR_SHELL=bash\n\trun: 'echo $$0'\n```\n\n\u003e More examples at file\n\n[Makefile](examples/shell.mk)\n\n## Stdout\n\nGet output by id\n\nUse to filter or apply some logic in last command executed\n\n```Makefile\nstdout:\n\t@$(dkr)\n\tinstance: alpine\n\trun: echo \"hello mkdkr!\"\n\trun: ps -ef\n\tlog: 1\n```\n\n\u003e `log: 1` return stout form second command `ps -ef`\n\n```Makefile\nstdout:\n\t@$(dkr)\n\tinstance: debian\n\trun: apt-get update\n\trun: apt-get install curl -y\n\trun: dpkg -l\n\tlog: 2 | grep -i curl \u0026\u0026 echo \"INSTALLED\"\n```\n\u003e `log: 2` return stdout from third command  `dpkg -l` and apply filter\n\n[Makefile](examples/stdout.mk)\n\n## Pipelines\n\nGroup of jobs for parallel and organization execution\n\n```Makefile\npipeline:\n\tmake test -j 3\t# parallel execution\n\tmake build\n\tmake pack\n\tmake deploy\n```\n\n[Makefile](examples/pipeline.mk)\n\n# Environment Variables\n\n| Name                         | Default                             | Description                                                             |\n|------------------------------|-------------------------------------|-------------------------------------------------------------------------|\n| MKDKR_TTL                    | 3600                                | The time limit to a job or service run                                  |\n| MKDKR_SHELL                  | sh                                  | Change to another shell eg. bash, csh                                   |\n| MKDKR_JOB_STDOUT             | last stdout                         | Path of file, generated with last stdout output                         |\n| MKDKR_JOB_NAME*              | (job\\|service)\\_target-name\\_(uuid) | Unique job name, used as container name suffix                          |\n| MKDKR_INCLUDE_CLONE_DEPTH    | 1                                   | In the most of case you no need change history for includes             |\n| MKDKR_BRANCH_NAME            |                                     | Return current git branch, if it exist                                  |\n| MKDKR_BRANCH_NAME_SLUG       |                                     | Return current git branch, if it exist, with safe values                |\n| MKDKR_NETWORK_ARGS           |                                     | Arguments of docker create networks                                     |\n| MKDKR_DOCKER_IMAGE_PULL      | missing                             | Set \"always\" to force pull images before docker instance creation       |\n| MKDKR_FORCE_DOWNLOAD_INCLUDE |                                     | \"true\" for download include files even it already dowloaded [no cached] |\n\n\u003e - to overwrite the values use: `export \u003cvar\u003e=\u003cvalue\u003e`\n\u003e - \\* auto generated\n\n# Migration\n\nMigration from release-0.26, just execute the following script on your terminal at root of your project.\n\n```bash\ncurl https://raw.githubusercontent.com/rosineygp/mkdkr/master/.mkdkr \u003e .mkdkr\n\nmkdkr_migration() {\n  sed -i 's/\\.\\.\\.\\ job\\ /instance:\\ /g;s/\\.\\.\\.\\ service\\ /service:\\ /g;s/\\.\\.\\.\\ privileged\\ /dind:\\ /g;s/\\.\\.\\.\\ /instance:\\ /g;s/\\.\\.\\ /run:\\ /g;s/@\\$(\\.)/@\\$(dkr)/g' ${1}\n}\n\nexport -f mkdkr_migration\n\nmkdkr_migration Makefile\n\nfind . -iname *.mk -exec bash -c 'mkdkr_migration \"$0\"' {} \\;\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosineygp%2Fmkdkr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosineygp%2Fmkdkr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosineygp%2Fmkdkr/lists"}