-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
121 lines (107 loc) · 3.12 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# https://taskfile.dev
version: '3'
dotenv: ['.env', '.env.local']
tasks:
_compose:
internal: true
preconditions:
- sh: test -f compose.yaml
msg: "compose.yaml file doesn't exists"
- sh: docker compose config --quiet && exit 0 || exit 1
msg: "composer.yaml hasn't a valid yaml format"
cmds:
- docker compose {{.COMPOSE_ARGS}} {{.CLI_ARGS}}
requires:
vars: [ COMPOSE_ARGS ]
_init:
internal: true
desc: Init docker networks
cmds:
- docker network create {{.TRAEFIK_NETWORK}} || true
requires:
vars: [ TRAEFIK_NETWORK ]
default:
silent: true
cmds:
- echo "Welcome to {{.PROJECT_NAME}} project !"
- task -l
config:
desc: Display the manifest (Display manifest for a specific container "task config -- service_name")
label: task config -- service_name
cmds:
- task: _compose
vars:
COMPOSE_ARGS: config
down:
desc: Remove containers and networks (Down a specific container with "task down -- service_name")
label: task down -- service_name
cmds:
- task: _compose
vars:
COMPOSE_ARGS: down
down-v:
desc: Remove containers, networks and volumes (Down specific container with "task down-v -- service_name")
label: task down-v -- service_name
prompt: This command will erase volumes. Do you want to continue ?
cmds:
- task: _compose
vars:
COMPOSE_ARGS: down -v
logs:
desc: Display container logs (Display logs of a specific container with "task logs -- service_name")
label: task logs -- service_name
cmds:
- task: _compose
vars:
COMPOSE_ARGS: logs -n 20
ps:
desc: Display list of containers (Display only a specific container "task ps -- service_name")
label: task ps -- service_name
cmds:
- task: _compose
vars:
COMPOSE_ARGS: ps -a
restart:
desc: Restart containers (Restart a specific container "task restart -- service_name")
label: task ps -- service_name
cmds:
- task: _compose
vars:
COMPOSE_ARGS: restart
shell:
desc: Connect to traefik container
label: task shell
vars:
TRAEFIK_CONTAINER_HASH:
sh: docker compose ps -q traefik
preconditions:
- sh: test {{.TRAEFIK_CONTAINER_HASH}} != ''
msg: "traefik is not running"
cmds:
- task: _compose
vars:
COMPOSE_ARGS: exec traefik sh
start:
desc: Start containers (Restart specific container with "task start -- service_name")
label: task start
cmds:
- task: _compose
vars:
COMPOSE_ARGS: start
stop:
desc: Stop containers (Stop a specific containers with "task stop -- service_name")
label: task stop
cmds:
- task: _compose
vars:
COMPOSE_ARGS: stop
up:
dir: '{{.USER_WORKING_DIR}}'
desc: Create and start containers (Up a specific containers with "task up -- service_name")
label: task up
deps:
- _init
cmds:
- task: _compose
vars:
COMPOSE_ARGS: up -d --build --remove-orphans --force-recreate