Skip to content

Commit

Permalink
docs: better examples for service
Browse files Browse the repository at this point in the history
- show new kind of functionality (helpers)
  • Loading branch information
rosineygp committed Mar 21, 2020
1 parent 17a0f5b commit 571ed97
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Table of contents
* [Implicit](#implicit)
* [mkdkr.csv](#mkdkr.csv)
* [Collection](#collection)
* [Helpers](#helpers)
* [slug](#slug)
* [Examples](#examples)
* [Simple](#simple)
* [Service](#service)
Expand Down Expand Up @@ -173,15 +175,15 @@ my-instance:

## service:

Create a docker container in detached mode. Useful to bring up a required service for a job, like a webserver or a database.
Create a docker container in detached mode. Useful to bring up a required service for a job, like a webserver or database.

```Makefile
my-service:
@$(dkr)
service: nginx # up a nginx
instance: alpine
```
Is possible start more de one service.
Is possible start more than one service.

```Makefile
multi-service:
Expand All @@ -194,14 +196,17 @@ multi-service:
```

> \* Instance and services are connected in same network<br>
> \*\* The name of service is the same of image name
> \*\* The name of service is the same of image name with safe values

| Image Name | Network Name |
|--------------------|--------------------|
| nginx | nginx |
| nginx:1.2 | nginx_1_2 |
| redis:3 | redis_3 |
| project/apache_1.2 | project_apache_1_2 |
| Image Name | Network Name |
|----------------------------|----------------------------|
| nginx | nginx |
| nginx:1.2 | nginx_1_2 |
| redis:3 | redis_3 |
| project/apache_1.2 | project_apache_1_2 |
| registry/my/service:latest | registry_my_service_latest |

> replace role `'s/:|\.|\/|-/_/g'`

**Parameters:**

Expand Down Expand Up @@ -344,6 +349,26 @@ The file contains four values per line in following order

> Small collection, use it as example
# Helpers

A set of small functions to common pipelines process.

## slug

Replace unsafe values from a string.

- safe for docker
- safe for network domain

```shell
slug "my/unsafe/v1.0.0:string"
# "my_unsafe_v1_0_0_0_string"
```

Usage example:

[service: multiply](examples/service.mk)

# Examples

## Simple
Expand Down

0 comments on commit 571ed97

Please sign in to comment.