-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
81 lines (68 loc) · 1.76 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
version: "3"
dotenv:
- "config.env"
env:
# TODO: Change name. Remember to also change the name of cmd/app/.
APP_NAME: "app"
VERSION: "v0.0.1"
ARTIFACTS: "./artifacts"
tasks:
# ------------------------------------ Go ------------------------------------
go:run:
cmds:
- go run cmd/{{.APP_NAME}}/main.go
env:
# Additions or overrides of variables from global env and env files.
LOG_LEVEL: "debug"
LOG_JSON: "false"
go:lint:
cmds:
- golangci-lint --timeout=120s run ./...
go:test:
cmds:
- go test -v ./...
go:build:
cmds:
- |
go build \
-ldflags " \
-X main.appName={{.APP_NAME}} \
-X main.version={{.VERSION}} \
" -o {{.ARTIFACTS}}/app.bin cmd/{{.APP_NAME}}/main.go
env:
# TODO: Change OS and ARCH if neccessary.
GOOS: "linux"
GOARCH: "amd64"
go:generate:
cmds:
- go generate ./...
go:update:
cmds:
- go get -u ./...
- go mod tidy
go:license-check:
cmds:
- go-licenses check ./... --disallowed_types=forbidden -v 1
# ---------------------------------- Docker ----------------------------------
docker:build:
cmds:
- |
docker build -t {{.REGISTRY}}/{{.APP_NAME}}:{{.VERSION}} \
--build-arg app_name={{.APP_NAME}} \
--build-arg artifacts={{.ARTIFACTS}} \
-f ./build/package/Dockerfile .
docker:run:
cmds:
- |
docker run -it --rm \
--name {{.APP_NAME}} \
--env=ADDRESS=:8080 \
-p 8080:8080 \
{{.REGISTRY}}/{{.APP_NAME}}:{{.VERSION}}
docker:push:
cmds:
- docker push {{.REGISTRY}}/{{.APP_NAME}}:{{.VERSION}}
default:
desc: "Default task"
cmds:
- task --list-all