-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathTaskfile.yml
More file actions
162 lines (121 loc) · 4.52 KB
/
Taskfile.yml
File metadata and controls
162 lines (121 loc) · 4.52 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# https://taskfile.dev
version: "3"
# Load environment-specific .env file
dotenv:
- .env
env:
UID:
sh: id -u
GID:
sh: id -g
vars:
DOCKER_CMD:
sh: command -v docker-compose &> /dev/null && echo "docker-compose" || echo "docker compose"
COMPOSE_PROFILES:
map:
all: "'*'"
core: "core"
debug: "debug"
discourse: "discourse"
tasks:
# Default task
default:
desc: List all tasks
cmds:
- task --list
# Docker container management tasks
docker:up-*:
desc: Start Docker containers for a given profile (Usage - task docker:up-[core|debug|discourse|all])
summary: |
Start a set of Docker containers at a given time. The core services are always started with any profile.
For just the core services, use:
task docker:up-core
To include phpMyAdmin and Mailhog, use:
task docker:up-debug
To include the Discourse set of containers, use:
task docker:up-discourse
If you want to start all containers, use:
task docker:up-all
requires: &PROFILE_REQUIRES
vars:
- name: PROFILE
enum: [core, debug, discourse, all]
vars: &PROFILE_VARS
PROFILE: "{{index .MATCH 0}}"
cmds:
- '{{.DOCKER_CMD}} --profile {{ index .COMPOSE_PROFILES .PROFILE }} up -d'
docker:down-*:
desc: Stop Docker containers for a given profile (Usage - task docker:down-[core|debug|discourse|all])
summary: |
Stop a set of Docker containers at a given time. The core services are always stopped with any profile.
For just the core services, use:
task docker:down-core
To include phpMyAdmin and Mailhog, use:
task docker:down-debug
To include the Discourse set of containers, use:
task docker:down-discourse
If you want to stop all containers, use:
task docker:down-all
requires: *PROFILE_REQUIRES
vars: *PROFILE_VARS
cmds:
- '{{.DOCKER_CMD}} --profile {{ index .COMPOSE_PROFILES .PROFILE }} down'
docker:rebuild-*:
desc: Rebuild Docker containers for a given profile (Usage - task docker:rebuild-[core|debug|discourse|all])
summary: |
Rebuild a set of Docker containers at a given time. The core services are always rebuilt with any profile.
For just the core services, use:
task docker:rebuild-core
To include phpMyAdmin and Mailhog, use:
task docker:rebuild-debug
To include the Discourse set of containers, use:
task docker:rebuild-discourse
To rebuild all containers, use:
task docker:rebuild-all
requires: *PROFILE_REQUIRES
vars: *PROFILE_VARS
cmds:
- '{{.DOCKER_CMD}} --profile {{ index .COMPOSE_PROFILES .PROFILE }} down -v --rmi all'
- '{{.DOCKER_CMD}} --profile {{ index .COMPOSE_PROFILES .PROFILE }} up -d'
docker:restart-*:
desc: Restart Docker containers for a given profile (Usage - task docker:restart-[core|debug|discourse|all])
summary: |
Restart a set of Docker containers at a given time. The core services are always restarted with any profile.
For just the core services, use:
task docker:restart-core
To include phpMyAdmin and Mailhog, use:
task docker:restart-debug
To include the Discourse set of containers, use:
task docker:restart-discourse
To restart all containers, use:
task docker:restart-all
requires: *PROFILE_REQUIRES
vars: *PROFILE_VARS
cmds:
- '{{.DOCKER_CMD}} --profile {{ index .COMPOSE_PROFILES .PROFILE }} restart'
docker:logs:
desc: Show the logs for the core application container.
cmds:
- cmd: docker logs -f restarters
ignore_error: true
docker:shell:
desc: Open a shell into the core application container.
cmds:
- cmd: docker exec -it restarters bash
ignore_error: true
docker:run:bash:
desc: Run a bash command in the core application container.
summary: |
Run a bash command in the core application container. To pass the arguments, use the -- flag.
For example, to run the ls command, use:
task docker:run:bash -- ls -la
cmds:
- docker exec -it restarters bash -c "{{ .CLI_ARGS }}"
docker:run:artisan:
desc: Run an artisan command in the core application container.
summary: |
Run an artisan command in the core application container. To pass the arguments, use the -- flag.
For example, to run the migrate command, use:
task docker:run:artisan -- migrate
cmds:
- docker exec -it restarters php artisan "{{ .CLI_ARGS }}"