-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTaskfile.yml
95 lines (78 loc) · 2.1 KB
/
Taskfile.yml
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
---
# yaml-language-server: $schema=https://json.schemastore.org/taskfile.json
version: '3'
silent: true
vars:
# this needs to be run inside bash since taskfile uses https://github.com/mvdan/sh to run commands
NODE_ENV: |
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm";
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh";
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh";
nvm use;
COMPOSE: docker-compose --file deploy/docker-compose.yml
env:
DOCKER_TARGET: dev
PUPPETEER_SKIP_DOWNLOAD: 1
tasks:
default: task --list
init:node:
desc: Install required version of node
cmds:
- bash -c '{{ .NODE_ENV }} nvm install'
init:yarn:
desc: Install yarn
cmds:
- bash -c '{{ .NODE_ENV }} npm install --global yarn'
init:local:
desc: Init repository for local development
cmds:
- task: init:node
- task: init:yarn
- bash -c '{{ .NODE_ENV }} yarn install'
lint:local:
desc: Lint code with eslint
cmds:
- bash -c '{{ .NODE_ENV }} yarn lint'
run:debug:
desc: Runs docker image used for debugging
cmds:
- "{{ .COMPOSE }} --profile debug up"
run:
desc: Alias for start
cmds:
- 'task start -- {{ .CLI_ARGS }}'
start:
desc: Build docker image and container, use `task start -- --build` to rebuild
cmds:
- "{{ .COMPOSE }} up {{ .CLI_ARGS }}"
stop:
desc: Stop all containers
cmds:
- "{{ .COMPOSE }} down {{ .CLI_ARGS }}"
restart:
desc: Stops and starts containers
cmds:
- task stop
- task start
start:local:
desc: Run app locally
cmds:
- bash -c '{{ .NODE_ENV }} yarn start'
test:
desc: Run tests in docker
cmds:
- docker-compose --file deploy/docker-compose.test.yml up --build
test:local:
desc: Run tests locally
cmds:
- bash -c '{{ .NODE_ENV }} yarn test -- {{ .CLI_ARGS }}'
build:local:
desc: Build app locally
cmds:
- bash -c '{{ .NODE_ENV }} yarn build'
build:
desc: Build app image
env:
DOCKER_TARGET: prod
cmds:
- '{{ .COMPOSE }} build {{ .CLI_ARGS }}'